XCode Xcode中斷點的威力

2021-06-22 06:09:20 字數 3458 閱讀 5075

注:本文由破船譯自:albertopasca

符號斷點(symbolic breakpoint)

符號斷點可以中斷某個函式的呼叫。

2、列印到控制台

使用nslog列印字串

使用斷點來替換nslog**(或者在執行時新增乙個nslog)——與**寫nslog的效果相同。

使用nslog列印物件(po)

帶條件的列印

例如:當anumber大於10才列印出「str」的內容。

例如,在迴圈中希望i大於5才開始列印。

for ( int i=0; i<10; i++ ) 

使用「ignore」值,並利用下面的**進行列印:

在執行的時候,根據條件設定斷點有時候非常有用。

5、lldb中有用的一些命令

當xcode停留在某個斷點時,我們可以通過控制台(console)與lldb進行互動。

列印幫助

(lldb) help
列印呼叫棧(bt)

(lldb) bt 

* thread #1: tid = 0x1c03, 0x00003146 debug`-[apviewcontroller callme:andanumber:](self=0x07187e50, _cmd=0x000038b9, str=0x0715aa40, anum=38) + 230 at apviewcontroller.m:33, stop reason = breakpoint 3.1

frame #0: 0x00003146 debug`-[apviewcontroller callme:andanumber:](self=0x07187e50, _cmd=0x000038b9, str=0x0715aa40, anum=38) + 230 at apviewcontroller.m:33

frame #1: 0x0000304a debug`-[apviewcontroller viewdidload](self=0x07187e50, _cmd=0x005c5a77) + 122 at apviewcontroller.m:16

frame #2: 0x000f41c7 uikit`-[uiviewcontroller loadviewifrequired] + 536

frame #3: 0x000f4232 uikit`-[uiviewcontroller view] + 33

frame #4: 0x000433d5 uikit`-[uiwindow addrootviewcontrollerviewifpossible] + 66

frame #5: 0x0004376f uikit`-[uiwindow _sethidden:forced:] + 368

frame #6: 0x00043905 uikit`-[uiwindow _orderfrontwithout******key] + 49

frame #7: 0x0004c917 uikit`-[uiwindow makekeyandvisible] + 65

frame #15: 0x01becdf9 graphicsservices`_purpleeventcallback + 339

frame #16: 0x01becad0 graphicsservices`purpleeventcallback + 46

frame #17: 0x01c06bf5 corefoundation`__cfrunloop_is_calling_out_to_a_source1_perform_function__ + 53

frame #18: 0x01c06962 corefoundation`__cfrunloopdosource1 + 146

frame #19: 0x01c37bb6 corefoundation`__cfrunlooprun + 2118

frame #20: 0x01c36f44 corefoundation`cfrunlooprunspecific + 276

frame #21: 0x01c36e1b corefoundation`cfrunloopruninmode + 123

frame #24: 0x00002b22 debug`main(argc=1, argv=0xbffff3a4) + 130 at main.m:16

frame #25: 0x00002a55 debug`start + 53

(lldb)

列印最基本的內容 (p)

(lldb) print anint
列印物件(po)

(lldb) po anobj 

(lldb) po 0x0715aa40

列印表示式(expr)

(lldb) expr 5+2 

(lldb) expr astring = @"anewvalue"

列印執行緒中的一些東西

(lldb) help frame

eplan中斷點編號 eplan中斷點怎麼關聯

答 首先請雙擊中斷點,看他們的 完整裝置識別符號 是否相同。只有相同的時候才能連起來。因為你加了位置框,如果在同一頁內,會使中斷點的完整識別符號中的 位置 發生變化,所以連不起來。把完整識別符號改一致之後,裝置連起來了,如果顯示有誤,就打.答 在這個導航器的中斷點名稱上點右鍵,有個分類,在這裡可以調...

eclipse中斷點除錯debug

幾乎沒有用過debug模式,每次想要知道結果都是sysou一下。記得曾經問亂碼問題,jfinal說打斷點除錯看在 出錯。簡單記下普通除錯。1.在需要檢視的地方打斷點,方法是在行號右側雙擊。2.執行這個方法為右鍵debug as.3.程式會終止到你想要除錯的地方。這時,滑鼠懸浮到你想要的變數上面,這時...

當前不會命中斷點

今天除錯程式時,有乙個else if不會判斷,如下 if websiteid website.anjuke else if websiteid website.liebiao else if websiteid website.house365 當websiteid website.house365...