LLDB 学习

2020-04-02  本文已影响0人  化二缺

常用LLDB 指令

指令格式

<command> [<subcommand>[ <subcommand>...] ] <action> [- options [option-value]] [argument | argument...]

比如 给 test 函数设置断点
breakpoint set -n -test

  • 查看指令的用法
  • 比如help breakpoint


    help命令实例.png
expression <cmd-options> -- <expr>

expression self.view.backgroundColor = [UIColor redColor] (OC)
expression self.view.backgroundColor = UIColor.red (swift)

可以动态的给程序添加一句代码,而不用在程序里面写 并且实时的看到调试效果 ,为了简单起见可以直接用p
p self.view.backgroundColor = UIColor.red

thread backtrace
打印函数调用堆栈信息.png
breakpoint
  • breakpoint set -a 函数地址
  • breakpoint set -r 正则表达式
  • breakpoint set -s 动态库 -n 函数名
  • breakpoint list
    列出所有的断点(每个断点都有自己的编号)
  • breakpoint disable 断点编号: 禁用断点
  • breakpoint enable 断点编号:启用断点
  • breakpoint delete 断点编号 :删除断点
  • breakpoint command add 断点编号
    给断点预先设置需要执行的命令 到触发断点时,就会按照顺序执行


    给断点加断点卡住时需要执行的命令.png

    相当于


    直接用Xcode操作.png
  • breakpoint command list 断点编号
    查看某个断点设置的命令
    -breakpoint command delete 断点编号
    删除某个断点的设置命令
内存断点

watchpoint set variable self->age

watchpoint set expression &(self->_age)

  • watchpoint list
  • watchpoint disable 断点编号
  • watchpoint enable 断点编号
  • watchpoint delete 断点编号
  • watchpoint command add 断点编号
  • watchpoint command list 断点编号
  • watchpoint command delete 断点编号
模块查找 image lookup
查找某个类型的信息.png
上一篇 下一篇

猜你喜欢

热点阅读