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 进行汇编代码的修改。)