iOS LLDB(Low Lever Debug)

一、概述

LLDB(Low Lever Debug這里的low指輕量級(jí))默認(rèn)內(nèi)置于Xcode中的動(dòng)態(tài)調(diào)試工具。標(biāo)準(zhǔn)的 LLDB 提供了一組廣泛的命令,旨在與老版本的 GDB 命令兼容。 除了使用標(biāo)準(zhǔn)配置外,還可以很容易地自定義 LLDB 以滿足實(shí)際需要。

二、LLDB語(yǔ)法

<command> [<subcommand> [<subcommand>...]] <action> [-options [option-value]] [argument [argument...]]
  • command:命令
  • subcommand:子命令
  • action:執(zhí)行命令的操作
  • options:命令選項(xiàng)
  • arguement:參數(shù)
  • []:表示可選

例子:

//command     action    option    arguement
breakpoint    set       -n        test1

唯一匹配原則:根據(jù)n個(gè)字母已經(jīng)能唯一匹配到某個(gè)命令,則只寫(xiě)n個(gè)字母等效于完整的命令(大小寫(xiě)敏感)。也就是說(shuō)只要能識(shí)別出來(lái)命令唯一就可以:

br s -n test1

help

直接在LLDB中輸入help可以查看所有的LLDB命令。
查看某一個(gè)命令help <command-name>/help <command> <subcommand>:

help breakpoint
help breakpoint set

apropos

apropos可以用來(lái)搜索命令相關(guān)信息。

//將所有breakpoint命令搜索出來(lái)
apropos breakpoint

三、lldb常用命令

3.1 lldb斷點(diǎn)設(shè)置

3.1.1 breakpoint

breakpoint set

  • set 是子命令
  • -n 是選項(xiàng)--name 的縮寫(xiě)。

根據(jù)方法名設(shè)置斷點(diǎn)
breakpoint set -n test1,相當(dāng)于對(duì)符號(hào)test1下斷點(diǎn),所有的test1都會(huì)被斷?。?/p>

Breakpoint 4: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010be80d00

這和在Xcode中設(shè)置符號(hào)斷點(diǎn)是一樣的:

image.png

區(qū)別是前者重新啟動(dòng)后就失效了。

設(shè)置組斷點(diǎn)
breakpoint set -n "[ViewController click1:]" -n "[ViewController click2:]" -n "[ViewController click3:]"相當(dāng)于下了一組斷點(diǎn):

(lldb) breakpoint set -n "[ViewController click1:]" -n "[ViewController click2:]" -n "[ViewController click3:]"
Breakpoint 6: 3 locations.
(lldb) breakpoint list 6
6: names = {'[ViewController click1:]', '[ViewController click1:]', '[ViewController click1:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click3:]', '[ViewController click3:]', '[ViewController click3:]'}, locations = 3, resolved = 3, hit count = 0
  6.1: where = LLDBTest`-[ViewController click1:] at ViewController.m:31, address = 0x000000010be80e00, resolved, hit count = 0 
  6.2: where = LLDBTest`-[ViewController click2:] at ViewController.m:35, address = 0x000000010be80e40, resolved, hit count = 0 
  6.3: where = LLDBTest`-[ViewController click3:] at ViewController.m:40, address = 0x000000010be80e80, resolved, hit count = 0 

可以同時(shí)啟用和禁用組斷點(diǎn)。

使用-f指定文件

(lldb) br set -f ViewController.m -n click1:
Breakpoint 12: where = LLDBTest`-[ViewController click1:] at ViewController.m:31, address = 0x000000010be80e00

使用-l指定某一行設(shè)置斷點(diǎn)

(lldb) br set -f ViewController.m -l 40
Breakpoint 13: where = LLDBTest`-[ViewController click3:] at ViewController.m:40, address = 0x000000010be80e80

使用-c設(shè)置條件斷點(diǎn)
只要計(jì)算的結(jié)果是個(gè)bool型或整型數(shù)值就可以。test2:方法接收一個(gè)布爾值參數(shù),則當(dāng)傳入的值為YES時(shí)才斷住:

(lldb) br set -n test2: -c enable==YES
Breakpoint 1: where = LLDBTest`-[ViewController test2:] at ViewController.m:45, address = 0x0000000100dc1e80

使用-F設(shè)置函數(shù)全名

(lldb) br set -F test1
Breakpoint 1: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010762ecb0

使用-a設(shè)置地址斷點(diǎn)

(lldb)  br set -a 0x000000010762ecb0
Breakpoint 2: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010762ecb0

使用--selector設(shè)置斷點(diǎn)

(lldb) br set -n touchesBegan:withEvent:
Breakpoint 2: 97 locations.
(lldb) br set --selector touchesBegan:withEvent:
Breakpoint 3: 97 locations.

--selector在這里和-n等價(jià)都是全部匹配。不過(guò)-n是針對(duì)符號(hào),--selector針對(duì)OC的方法。

使用-r模糊匹配

(lldb) br set -f ViewController.m -r test
Breakpoint 4: 2 locations.
(lldb) br list
Current breakpoints:
4: regex = 'test', locations = 2, resolved = 2, hit count = 0
  4.1: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010762ecb0, resolved, hit count = 0 
  4.2: where = LLDBTest`-[ViewController test2:] at ViewController.m:45, address = 0x000000010762ee80, resolved, hit count = 0

使用-i設(shè)置忽略次數(shù)

(lldb) br set -f ViewController.m -r test -i 3
Breakpoint 1: 2 locations.

這里的次數(shù)是這組所有斷點(diǎn)加起來(lái)的次數(shù)。

breakpoint list

查看斷點(diǎn)列表:

(lldb) br l
Current breakpoints:
7: names = {'[ViewController click1:]', '[ViewController click1:]', '[ViewController click1:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click3:]', '[ViewController click3:]', '[ViewController click3:]'}, locations = 3, resolved = 3, hit count = 0
  7.1: where = LLDBTest`-[ViewController click1:] at ViewController.m:31, address = 0x000000010be80e00, resolved, hit count = 0 
  7.2: where = LLDBTest`-[ViewController click2:] at ViewController.m:35, address = 0x000000010be80e40, resolved, hit count = 0 
  7.3: where = LLDBTest`-[ViewController click3:] at ViewController.m:40, address = 0x000000010be80e80, resolved, hit count = 0 

查看某一個(gè)/某一組斷點(diǎn):

(lldb) br l
Current breakpoints:
7: names = {'[ViewController click1:]', '[ViewController click1:]', '[ViewController click1:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click3:]', '[ViewController click3:]', '[ViewController click3:]'}, locations = 3, resolved = 3, hit count = 0
  7.1: where = LLDBTest`-[ViewController click1:] at ViewController.m:31, address = 0x000000010be80e00, resolved, hit count = 0 
  7.2: where = LLDBTest`-[ViewController click2:] at ViewController.m:35, address = 0x000000010be80e40, resolved, hit count = 0 
  7.3: where = LLDBTest`-[ViewController click3:] at ViewController.m:40, address = 0x000000010be80e80, resolved, hit count = 0 

8: name = 'test1', locations = 1, resolved = 1, hit count = 0
  8.1: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010be80d00, resolved, hit count = 0 

(lldb) br l 8
8: name = 'test1', locations = 1, resolved = 1, hit count = 0
  8.1: where = LLDBTest`test1 at ViewController.m:17, address = 0x000000010be80d00, resolved, hit count = 0 

(lldb) br l 7
7: names = {'[ViewController click1:]', '[ViewController click1:]', '[ViewController click1:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click2:]', '[ViewController click3:]', '[ViewController click3:]', '[ViewController click3:]'}, locations = 3, resolved = 3, hit count = 0
  7.1: where = LLDBTest`-[ViewController click1:] at ViewController.m:31, address = 0x000000010be80e00, resolved, hit count = 0 
  7.2: where = LLDBTest`-[ViewController click2:] at ViewController.m:35, address = 0x000000010be80e40, resolved, hit count = 0 
  7.3: where = LLDBTest`-[ViewController click3:] at ViewController.m:40, address = 0x000000010be80e80, resolved, hit count = 0 

breakpoint disable/enable/delete

breakpoint disable

(lldb) br dis 7.1
1 breakpoints disabled.
image.png

breakpoint enable

(lldb) br en 7.1
1 breakpoints enabled.

breakpoint delete
只能刪除指定組斷點(diǎn),不能刪除組里面的某一個(gè)。

(lldb) br del 7.2
0 breakpoints deleted; 1 breakpoint locations disabled.
(lldb) br del 7
1 breakpoints deleted; 0 breakpoint locations disabled.

breakpoint delete刪除所有斷點(diǎn)

(lldb) breakpoint delete
About to delete all breakpoints, do you want to do that?: [Y/n] y
All breakpoints removed. (3 breakpoints)

??breakpoint組在一次運(yùn)行過(guò)程中是一直遞增的。多次添加斷點(diǎn)只會(huì)斷住一次。

3.1.2 watchpoint 內(nèi)存斷點(diǎn)/地址斷點(diǎn)

breakpoint是對(duì)方法生效的斷點(diǎn),watchpoint是對(duì)地址生效的斷點(diǎn)。如果地址里中的數(shù)據(jù)改變了,就讓程序中斷。

watchpoint set

watchpoint set variable

(lldb) watchpoint set variable item1->_name
Watchpoint created: Watchpoint 1: addr = 0x600002ce8868 size = 8 state = enabled type = w
    declare @ '/Users/zaizai/LLDBTest/LLDBTest/ViewController.m:28'
    watchpoint spec = 'item1->_name'
    new value: 0x000000010ad37038

改變name值的時(shí)候就會(huì)斷?。词怪禌](méi)有變):

Watchpoint 1 hit:
old value: 0x0000000109319038
new value: 0x0000000109319038

watchpoint set variable傳入的是變量名,不接受方法。所以不能使用watchpoint set variable item1.name

watchpoint set expression

(lldb) p item1->_name
(__NSCFConstantString *) $0 = 0x000000010a0d0038 @"1"
(lldb) p &item1->_name
(NSString **) $1 = 0x00006000033bec48
(lldb) watchpoint set expression 0x00006000033bec48
Watchpoint created: Watchpoint 1: addr = 0x6000033bec48 size = 8 state = enabled type = w
    new value: 4463591480

breakpoint類似,watchpoint也有watchpoint list、watchpoint disable、watchpoint enable、watchpoint delete。

3.2 lldb代碼執(zhí)行 expression、p、print、call、po

expression執(zhí)行一個(gè)表達(dá)式,并將表達(dá)式返回的結(jié)果輸出。

expression <cmd-options> -- <expr>
  • cmd-options:命令選項(xiàng),一般使用默認(rèn)。
  • --:命令選項(xiàng)結(jié)束符。
  • expr:表達(dá)式。

p、printcall 都是expression --的別名:

  • print: 打印某個(gè)東西,可以是變量/表達(dá)式,pprint的縮寫(xiě)。
  • call: 調(diào)用某個(gè)方法。

poexpression -O --的別名。調(diào)用的是description或者debugDescription方法。

進(jìn)制轉(zhuǎn)換p/x、p/o、p/t
p除了打印還有常量的進(jìn)制轉(zhuǎn)換功能。

//默認(rèn)10進(jìn)制打印
(lldb) p 100
(int) $0 = 100
//16進(jìn)制打印
(lldb) p/x 100
(int) $1 = 0x00000064
//8進(jìn)制打印
(lldb) p/o 100
(int) $2 = 0144
//2進(jìn)制打印
(lldb) p/t 100
(int) $3 = 0b00000000000000000000000001100100
//字符串轉(zhuǎn)換為10進(jìn)制
(lldb) p/d 'A'
(char) $4 = 65
//10進(jìn)制轉(zhuǎn)換為字符
(lldb) p/c 65
(int) $5 = A\0\0\0

浮點(diǎn)數(shù)轉(zhuǎn)換

(lldb) p/x (double) 180.0
(double) $6 = 0x4066800000000000

(lldb) p/f 0x4066800000000000
(long) $1 = 180

(lldb) e -f f -- 0x4066800000000000
(long) $2 = 180

x/nuf<addr>

(lldb) x self
0x600002c12180: 29 8a 00 00 01 80 1d 00 00 00 00 00 00 00 00 00  )...............
0x600002c12190: 0e 00 00 00 00 00 00 00 00 5e 75 01 00 60 00 00  .........^u..`..
(lldb) x/4gx self
0x600002c12180: 0x001d800100008a29 0x0000000000000000
0x600002c12190: 0x000000000000000e 0x0000600001755e00
(lldb) x/4gw self
0x600002c12180: 0x00008a29 0x001d8001 0x00000000 0x00000000

x/nuf<addr>
x就是 memory read 內(nèi)存讀取。

  • n: n表示要打印的內(nèi)存單元的個(gè)數(shù)。
  • u: u表示一個(gè)地址單元的長(zhǎng)度。iOS是小端模式。
    • b表示單字節(jié)
    • h表示雙字節(jié)
    • w表示四字節(jié)
    • g表示八字節(jié)。
  • ff表示顯示方式。
    • x按十六進(jìn)制格式顯示變量
    • d按十進(jìn)制顯示
    • u按十進(jìn)制顯示無(wú)符號(hào)整形
    • o按八進(jìn)制顯示變量
    • t按二進(jìn)制顯示變量
    • a按十六進(jìn)制顯示變量
    • i指令地址格式
    • c按字符格式顯示變量
    • f按浮點(diǎn)數(shù)格式顯示變量
  • addr:地址/數(shù)據(jù)。

3.3查看堆棧信息

bt(thread backtrace)

 thread #1, queue = 'com.apple.main-thread', stop reason = step over
  * frame #0: 0x000000010e60fa06 LLDBTest`-[ViewController touchesBegan:withEvent:](self=0x00007fce43806030, _cmd="touchesBegan:withEvent:", touches=1 element, event=0x0000600002168540) at ViewController.m:46:23
    frame #1: 0x00007fff246ca70f UIKitCore`forwardTouchMethod + 321
    frame #2: 0x00007fff246ca5bd UIKitCore`-[UIResponder touchesBegan:withEvent:] + 49
    frame #3: 0x00007fff246d95b5 UIKitCore`-[UIWindow _sendTouchesForEvent:] + 622
    frame #4: 0x00007fff246db6c7 UIKitCore`-[UIWindow sendEvent:] + 4774
    frame #5: 0x00007fff246b5466 UIKitCore`-[UIApplication sendEvent:] + 633
    frame #6: 0x00007fff24745f04 UIKitCore`__processEventQueue + 13895
    frame #7: 0x00007fff2473c877 UIKitCore`__eventFetcherSourceCallback + 104
    frame #8: 0x00007fff2039038a CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #9: 0x00007fff20390282 CoreFoundation`__CFRunLoopDoSource0 + 180
    frame #10: 0x00007fff2038f764 CoreFoundation`__CFRunLoopDoSources0 + 248
    frame #11: 0x00007fff20389f2f CoreFoundation`__CFRunLoopRun + 878
    frame #12: 0x00007fff203896d6 CoreFoundation`CFRunLoopRunSpecific + 567
    frame #13: 0x00007fff2c257db3 GraphicsServices`GSEventRunModal + 139
    frame #14: 0x00007fff24696cf7 UIKitCore`-[UIApplication _run] + 912
    frame #15: 0x00007fff2469bba8 UIKitCore`UIApplicationMain + 101
    frame #16: 0x000000010e60fff2 LLDBTest`main(argc=1, argv=0x00007ffee15efd20) at main.m:17:12
    frame #17: 0x00007fff2025a3e9 libdyld.dylib`start + 1

up、down、frame select

(lldb) up
frame #3: 0x00007fff246d95b5 UIKitCore`-[UIWindow _sendTouchesForEvent:] + 622
UIKitCore`-[UIWindow _sendTouchesForEvent:]:
->  0x7fff246d95b5 <+622>: lea    rax, [rip + 0x628a699c]   ; UIApp
    0x7fff246d95bc <+629>: mov    rdi, qword ptr [rax]
    0x7fff246d95bf <+632>: mov    rsi, qword ptr [rbp - 0x170]
    0x7fff246d95c6 <+639>: mov    rdx, r12
    0x7fff246d95c9 <+642>: mov    rcx, rbx
    0x7fff246d95cc <+645>: mov    r8, r14
    0x7fff246d95cf <+648>: call   r13
    0x7fff246d95d2 <+651>: mov    ecx, 0x1
(lldb) down 
frame #2: 0x00007fff246ca5bd UIKitCore`-[UIResponder touchesBegan:withEvent:] + 49
UIKitCore`-[UIResponder touchesBegan:withEvent:]:
->  0x7fff246ca5bd <+49>: mov    rdi, rbx
    0x7fff246ca5c0 <+52>: pop    rbx
    0x7fff246ca5c1 <+53>: pop    r12
    0x7fff246ca5c3 <+55>: pop    r14
    0x7fff246ca5c5 <+57>: pop    r15
    0x7fff246ca5c7 <+59>: pop    rbp
    0x7fff246ca5c8 <+60>: jmp    qword ptr [rip + 0x5bf063e2] ; (void *)0x00007fff2018f760: objc_release

UIKitCore`forwardTouchMethod:
    0x7fff246ca5ce <+0>:  push   rbp
(lldb) frame select 10
frame #10: 0x00007fff2038f764 CoreFoundation`__CFRunLoopDoSources0 + 248
CoreFoundation`__CFRunLoopDoSources0:
->  0x7fff2038f764 <+248>: mov    r13d, eax
    0x7fff2038f767 <+251>: jmp    0x7fff2038f7dc            ; <+368>
    0x7fff2038f769 <+253>: xor    r13d, r13d
    0x7fff2038f76c <+256>: jmp    0x7fff2038f802            ; <+406>
    0x7fff2038f771 <+261>: mov    rbx, r14
    0x7fff2038f774 <+264>: mov    rdi, qword ptr [rbp - 0x38]
    0x7fff2038f778 <+268>: call   0x7fff20312bcc            ; CFArrayGetCount
    0x7fff2038f77d <+273>: mov    r15, rax

這3個(gè)命令只是方便我們查看堆棧信息,寄存器還是在斷點(diǎn)處。

frame variable
查看當(dāng)前frame參數(shù)

(lldb) frame variable
(ViewController *) self = 0x00007f8c59405600
(SEL) _cmd = "touchesBegan:withEvent:"
(BOOL) enable = NO

在已經(jīng)執(zhí)行過(guò)的frame中修改參數(shù)不會(huì)影響后面的結(jié)果。

thread return

thread return可以接受一個(gè)表達(dá)式,調(diào)用命令之后直接從當(dāng)前的frame返回表達(dá)式的值。直接返回不執(zhí)行后面的代碼。相當(dāng)于回滾(相當(dāng)于直接到bl跳轉(zhuǎn)的下一行匯編代碼)。當(dāng)然修改pc寄存器的值也能達(dá)到相同的效果。

3.4 command指令

給斷點(diǎn)添加命令的命令。
breakpoint command add

(lldb) b test2:
Breakpoint 1: where = LLDBTest`-[ViewController test2:] at ViewController.m:65, address = 0x0000000103e7db40
(lldb) br command add 1
Enter your debugger command(s).  Type 'DONE' to end.
> frame variable
> DONE

當(dāng)斷點(diǎn)斷住的時(shí)候執(zhí)行frame variable指令。
當(dāng)然也可以只添加一條指令:

br command add -o "po self" 1

多次對(duì)同一個(gè)斷點(diǎn)添加命令,后面命令會(huì)將前面命令覆蓋

breakpoint command list
查看某個(gè)斷點(diǎn)已有的命令(list 后必須有斷點(diǎn)編號(hào))

(lldb) breakpoint command list 1
Breakpoint 1:
    Breakpoint commands:
      po self

3.5 target stop-Hook指令

target stop-hook命令可以在每次stop的時(shí)候去執(zhí)行一些命令

(lldb) target stop-hook add -o "frame variable"
Stop hook #1 added.

command不同的是它對(duì)所有斷點(diǎn)生效。相當(dāng)于對(duì)程序下鉤子。
display命令等價(jià):

(lldb) display frame variable
Stop hook #2 added.

target stop-hook只對(duì)breakpointwatchpointstop生效,直接點(diǎn)擊Xcode上的pause或者debug view hierarchy不會(huì)生效

target stop-hook list

(lldb) target stop-hook list
Hook: 1
  State: enabled
  Commands: 
    frame variable

Hook: 2
  State: enabled
  Commands: 
    expr -- frame variable

target stop-hook disable / enable
暫時(shí)讓某個(gè)stop-hook失效/生效,不傳id則代表全部。

target stop-hook delete / undisplay
刪除stop-hook

(lldb) target stop-hook delete
Delete all stop hooks?: [Y/n] y

delete可以不傳id,undisplay必須傳id。

3.6 image(target modules)指令

image lookup --address

查找某個(gè)地址具體對(duì)應(yīng)的文件位置,可以使用image lookup --address(image lookup -a)
比如有一個(gè)crash:

2021-05-19 18:19:45.833183+0800 LLDBTest[41719:24239029] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 5 beyond bounds [0 .. 2]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff20421af6 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff20177e78 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff2049e77f _CFThrowFormattedException + 194
    3   CoreFoundation                      0x00007fff20320825 -[__NSArrayM removeAllObjects] + 0
    4   LLDBTest                            0x0000000107c469f7 -[ViewController touchesBegan:withEvent:] + 151

從上面的堆??梢钥吹绞?code>-[ViewController touchesBegan:withEvent:]中的調(diào)用發(fā)生了crash,但是并不知道在ViewController.m的哪一行。使用image lookup -a就可以具體定位到確定的行數(shù):

(lldb) image lookup -a 0x0000000107c469f7
      Address: LLDBTest[0x00000001000019f7] (LLDBTest.__TEXT.__text + 807)
      Summary: LLDBTest`-[ViewController touchesBegan:withEvent:] + 151 at ViewController.m:48:28

image lookup --name

查找方法或者符號(hào)的信息可以使用image lookup --nameimage lookup -n):

(lldb) image lookup -n test2:
1 match found in /Users/zaizai/Library/Developer/Xcode/DerivedData/LLDBTest-enxwhkxlnnynraafdlfrcoxaibzm/Build/Products/Debug-iphonesimulator/LLDBTest.app/LLDBTest:
        Address: LLDBTest[0x0000000100001b30] (LLDBTest.__TEXT.__text + 1120)
        Summary: LLDBTest`-[ViewController test2:] at ViewController.m:65

image lookup --type

可以使用image lookup --type(image lookup -t)查看類型:

(lldb) image lookup -t ViewController
Best match found in /Users/zaizai/Library/Developer/Xcode/DerivedData/LLDBTest-enxwhkxlnnynraafdlfrcoxaibzm/Build/Products/Debug-iphonesimulator/LLDBTest.app/LLDBTest:
id = {0x100000033}, name = "ViewController", byte-size = 16, decl = ViewController.h:10, compiler_type = "@interface ViewController : UIViewController{
    NSMutableArray * _items;
}
@property(nonatomic, readwrite, getter = items, setter = setItems:) NSMutableArray *items;
@end"

3.7 .lldbinit

LLDB有了一個(gè)啟動(dòng)時(shí)加載的文件~/.lldbinit,每次啟動(dòng)都會(huì)加載。一些初始化的操作可以添加在.lldbinit中。由于這時(shí)候程序還沒(méi)有真正運(yùn)行,也有部分操作無(wú)法完成,比如設(shè)置斷點(diǎn)等。
chisellldb插件就是在.lldbinit初始化的。
直接在.lldbinit中添加:

target stop-hook add -o "frame variable"

這樣每次運(yùn)行都會(huì)自動(dòng)添加stop-hook

Stop hook #1 added.
(lldb) b -n test2:
Breakpoint 1: where = LLDBTest`-[ViewController test2:] at ViewController.m:65, address = 0x000000010c519b40
(ViewController *) self = 0x00007ffd95406160
(SEL) _cmd = "touchesBegan:withEvent:"
(BOOL) enable = NO

3.8 其它命令

  • image list: 查看某塊列表
  • register read: 讀取寄存器
  • register write: 寫(xiě)入寄存器
  • Memory read: 讀取內(nèi)存值

四、流程控制

image.png
  • c (continue/thread continue) :繼續(xù)執(zhí)行。
  • n(next/thread step-over):?jiǎn)尾竭\(yùn)行,將子函數(shù)當(dāng)做整體一步執(zhí)行。
    ni:?jiǎn)尾竭\(yùn)行匯編級(jí)別。
  • sstep/thread step-in):?jiǎn)尾竭\(yùn)行,遇到子函數(shù)會(huì)進(jìn)去。
    si:?jiǎn)尾竭\(yùn)行可跳轉(zhuǎn)指令內(nèi)部,匯編級(jí)別。
  • finishstep-out):表示直接走完當(dāng)前方法,返回到上層frame。

LLDB官網(wǎng)API文檔

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容