lldb命令的格式以下 :git
<noun> <verb> [-options [option-value]] [argument [argument..]]
breakpoint set --file foo.c --line 12 breakpoint set -f foo.c -l 12
breakpoint set --name foo breakpoint set -n foo
`breakpoint set -n foo -n bargithub
breakpoint set --method foo breakpoint set -M foo
breakpoint set --seletor alignLeftEdges: breakpoint set -S alignLeftEdges:
breakpoint set --shlib foo.dylib --name foo breakpoint set -s foo.dylib -n foo
能夠重複使用 --shlib來標記多個公共庫。segmentfault
breakpoint set -n "-[SKTGraphicView alignLeftEdges:]" br s -n "-[SKTGraphicView alignLeftEdges:]"
(lldb) br list No breakpoints currently set. (lldb) br li No breakpoints currently set.
使用 breakpoint delete id 刪除斷點,簡寫 br del, 使用breakpoint enable id 和 breakpoint disable id 來啓用或禁用斷點,安全
咱們能夠設置alias :函數
`command alias bfl breakpoint set -f %1 -l %2
`
`bfl foo.c 12
`用戶能夠修改~/.lldbinit文件,以存儲本身的快捷鍵。線程
process continue 取消暫停,繼續執行函數 ,別名是 continue,簡寫是 c. thread step-over : 執行當前函數中的一行代碼,可是不跳進函數。簡寫是 next ,n 。 thread step-in : 跳進函數中, 簡寫 step,s 。 thread step-out : 跳出函數,簡寫是 finish 。 thread list : 列出線程列表 thread backtrace : 列出線程堆棧。能夠經過thread select 2切換線程。 thread backtrace all 輸出全部線程堆棧 thread return <RETURN EXPRESSION> : 直接返回當前函數, 能夠設置返回值。
(lldb) frame info frame #0: 0x0000000114ab4e76 libsystem_kernel.dylib`mach_msg_trap + 10
能夠經過help命令查看幫助, 如help frame ,help thread , help process 。debug
調試的時候,咱們常常須要打印界面的層次,使用如下命令:調試
po [[UIApp keyWindow] recursiveDescription]
recursiveDescription是一個私有函數。會打印出view的全部層次信息。code
初始化程序,目的是從程序入口就開始進行附着,這樣咱們就能夠在一些安全防禦代碼執行以前,進行破解。 最經常使用的就是跳過ptrace事件
(lldb) breakpoint set -n isEven Breakpoint 1: where = DebuggerDance`isEven + 16 at main.m:4, address = 0x00000001083b5d00 (lldb) breakpoint modify -c 'i == 99' 1 (lldb) breakpoint command add 1 Enter your debugger command(s). Type 'DONE' to end. > p i > DONE
breakpoint modify -c 'i == 99' 1 指添加action的觸發條件。
ps:hopper中最經常使用的操做(直接修改彙編代碼 ,在菜單Modify - Assemble Instruction 進行彙編代碼的修改。)