常用LLDB指令
随风
2019-04-10 20:11:55
LLDB就是iOS上面的调试指令,命令格式是
command [ [...]] [-options [optionvalue]] [argument [argument...]]比如给test函数设置断点
breakpoint set -n test
help
玩过命令行的都应该知道这个命令,能给我们提供很多命令的帮助,而我们这里也可以使用这个指令查询帮助 比如:help breakpoint help breakpoint set
expression --
执行一个表达式 --表示命令选项结束符,比如expression self.view.backgroundColor = [UIColor redColor]expression、expression -- 和指令print、p、call的效果一样 expression -O --和指令po的效果一样
thread backtrace
打印线程堆栈信息,和指令bt的效果一样thread return []
让函数直接返回某个值,不会执行断点后面的代码frame variable []
打印当前帧的变量thread continue、continue、c
程序继续运行thread step-over、next、n
单步运行,把子函数当做整体一步执行thread step-in、step、s
单步运行,遇到子函数会进入子函数thread step-out、finish
直接执行完当前函数的所有代码,返回到上一个函数thread step-inst-over、nexti、ni
thread step-inst、stepi、si
si、ni和s、n类似
s、n是源码级别 si、ni是汇编指令级别breakpoint set
设置断点 breakpoint set -a 函数地址 breakpoint set -n 函数名 breakpoint set -r 正则表达式 breakpoint set -s 动态库 -n 函数名breakpoint set -n test breakpoint set -n touchesBegan:withEvent: breakpoint set -n "-[ViewController touchesBegan:withEvent:]"
breakpoint list
列出所有的断点,每个断点都有自己的编号breakpoint disable 断点编号
禁用断点breakpoint enable 断点编号
启用断点breakpoint delete 断点编号
删除断点breakpoint command add 断点编号
给断点预先设置需要执行的命令,到触发断点时,就会按顺序执行breakpoint command list 断点编号
查看某个断点设置的命令breakpoint command delete 断点编号
删除某个断点设置的命令image lookup
image lookup -t 类型:查找某个类型的信息 image lookup -a 地址:根据类型地址查找在模块中的位置 image lookup -n 符号或者函数名:查找某个符合或者函数的位置image list
列出所加载的模块信息image list -o -f打印模块的偏移地址,全路径