LLDB

2019-07-19  本文已影响0人  MakeThatChange

工作原理

使用目标
命令结构

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

格式

LLDB 命令行在解析操作执行命令之前完成。上面的这些元素之间通过空格来分割,如果某一元素自身含有空格,则可以使用双引号。而如果元素中又包含双引号,则可以使用反斜杠;或者元素使用单引号。

(lldb) command [subcommand] -option "some "inside" string"

(lldb) command [subcommand] -option 'some "inside" string'

一、breakpoint

1.breakpoint set

breakpoint set -f BreakpointVC.m -l 29 -c 'i == 5’

字符串相等

breakpoint set -f BreakpointVC.m -l 30 -c '[self.strName isEqualToString:@"我4"]'

-f 文件名
-l 行数
-d 失效
-i 跳过次数
breakpoint set -f RetHomeViewController.m -F breakPointClear -i 2
-o 运行一次后删除
-a 16位的物理地址
breakpoint set -a 0x10dcc0446
-T 线程名
-q 队列名称
-t 线程id
-x 线程位置
-C 添加command
breakpoint set -F breakPointClear -C bt
-G 运行完command是否断住
breakpoint set -F breakPointClear -G false
-N 添加别名
breakpoint set -n breakPointClear -N tao

2.breakpoint modify

breakpoint modify -c ‘i == 5' 2

执行到command是否自动断住 默认断住,false不断住
breakpoint modify -G true 2
-T 线程名

-t 线程tid

-q 线程队列
-x 线程位置
修改断点有效或者无效
-d/-e
breakpoint modify -c 'i == 5' -e 3
-i 断点次数
-o 一次断点

3.breakpoint delete/clear option

breakpoint clear
删除特定行断点

breakpoint clear -f RetHomeViewController.m -l 36

删除顺序中断点
breakpoint delete - D 2
删除所有断点
breakpoint delete -f

4.breakpoint list option

-b 断点信息
-f 全部信息
-i
-v

一、watchpoint

观察变量

1.watchpoint set

设置观察

watchpoint set variable self->_city

地址观察属性

p & _city
watchpoint set expression 0x00007ffc80e100c8

2.watchpoint modify

观察某个属性特定的值:

watchpoint modify -c ‘self->_age==10’ 1

3.watchpoint delete/list
删除观察

watchpoint delete

查看观察

watchpoint list

三、thread

线程跳转
thread jump -f RetHomeViewController.m -l 39
线程返回
thread return
顺序线程跳过断点
thread continue 1
选中线程
thread select 1
进入
thread step-in
退出
thread step-out
step-over
指令单步
step-inst
执行到行数
thread until -t 1 68

线程跳转
thread jump -f RetHomeViewController.m -l 39
线程返回
thread return
顺序线程跳过断点
thread continue 1
选中线程
thread select 1
进入
thread step-in
退出
thread step-out
step-over
指令单步
step-inst
执行到行数
thread until -t 1 68

线程栈 bt
thread backtrace
当前线程栈信息
thread info
当前所有线程
thread list

四、expression option

-O po 命令
expression -O -- self
修改变量值
expression self.age = 3
expression self.type = (ExpressionVCType)1
改变背景色
expression self.view.backgroundColor = [UIColor redColor]
expression [CATransaction flush]
-F 变量地址
expression -F -- self
-L 变量位置
expression -L — self

创建变量
e NSString string = (NSString *)@“aaa" e NSIntegernumber = (NSInteger)22

参考
上一篇 下一篇

猜你喜欢

热点阅读