lldb使用

lldb使用
文章图片
QQ20180511-120456.png 1. 常用命令
lldb使用
文章图片
四个按钮分别是:continue,step over,step into,step out

  • (lldb) thread step-over // The same as "next" or "n" in GDB.
  • (lldb) thread step-in // The same as "step" or "s" in GDB.
  • (lldb) thread step-out // The same as "finish" or "f" in GDB.
  • (lldb) thread step-inst // The same as "stepi" / "si" in GDB. 没什么用
  • (lldb) thread step-over-inst // The same as "nexti" / "ni" in GDB. 没什么用
lldb使用
文章图片
thread return 1000或者@"一个亿"
  • thread return @"xxxxx" :很重要,可以直接return想要的东西
lldb使用
文章图片
在当前界面, 可以直接设置运行到第几行停止 lldb使用
文章图片
在输出结果中我们还能看到类似于$0, $1这样的符号,我们可以将其看作是指向对象的一个引用,我们在lldb中可以直接使用$1, $1来操作对应的对象,这些东西存在于LLDB的命名空间中
  • po: 输出对象类型的, 实际上是调用了OC的description方法
  • p = print : 输出基本数据类型
lldb使用
文章图片
这个命令可以创建或获取内存中的一个对象, 我们可以操作这个对象, 创建是注意名字一定带$$$$$, 对象类型我们统一用id, 如果是基本数据, int, float无所谓 lldb使用
文章图片
根据崩溃信息地址, 可以查看 lldb使用
文章图片
查看一个类的成员变量和属性信息, 其实image就是一个lldb中的一个别名 lldb使用
文章图片
起个别名 2. 用控制台来改变窗口的颜色
lldb使用
文章图片
先用这个方法找到控制器View的地址 lldb使用
文章图片
用expression命令将view记录下来 lldb使用
文章图片
找了就赋值, 但是只有程序继续运行之后才会看到界面的变化。因为改变的内容必须被发送到渲染服务中,然后显示才会被更新。渲染服务实际上是一个另外的进程 (被称作 backboard)。这就是说即使我们正在调试的内容所在的进程被打断了,backboardd 也还是继续运行着的。这意味着你可以用CATransaction继续运行程序 3 线程的状态
  • 当进程停止后, lldb会停留在当前线程的当前帧(frame)上面
lldb使用
文章图片
获取所有线程状态 lldb使用
文章图片
查看当前线程的调用栈: 会把当前当前当前线程所有调用的方法全部展示出来 注: 星号(*)表示为当前线程 lldb使用
文章图片
查看所有线程的调用栈信息, 如图, 当前有3个线程 lldb使用
文章图片
查看当前帧的所有信息 注: 比线程小一级, 是线程中的一个frame lldb使用
文章图片
切换, 或者查看调用栈里面的信息 lldb使用
文章图片
variable并没有什么卵用event是个变量哈, info还行 3 给lldb安装个facebook出品的chisel插件
brew update brew install chise

if .lldbinit file doesn't exist you can create it & open it by tapping on the terminal
touch .lldbinit open .lldbinit

Then add the following line to your ~/.lldbinit file.
# ~/.lldbinit command script import/usr/local/opt/chisel/libexec/fblldb.py

The commands will be available the next time Xcode starts.
注: 参考文章[1][2][3]:
  1. https://blog.csdn.net/u013822374/article/details/50963108 ?
  2. https://www.cnblogs.com/jiahao89/p/6142437.html ?
  3. 【lldb使用】https://www.jianshu.com/p/d6a0a5e39b0e ?

    推荐阅读