Dan*_*nra 3 breakpoints conditional-breakpoint lldb
根据内存中的值在lldb中设置条件断点的语法是什么?
就像是:
breakpoint modify -c "memory read -Gx $esp+4 == 0"
或者,我想如果条件为false,我可以设置断点命令继续,但我也找不到它的语法:)
breakpoint modify的--condition参数采用C++表达式,在命中断点时对其进行求值,如果结果为非零(true),则断点停止.
(lldb) br s -n foo
Breakpoint 1: where = a.out`foo, address = 0x00001f30
(lldb) br mod -c '*(int*) ($esp+4) == 10'
(lldb) r
Process 11102 launched: '/private/tmp/a.out' (i386)
Process 11102 stopped
* thread #1: tid = 0x42c6f9, 0x00001f30 a.out`foo, queue = 'com.apple.main-thread, stop reason = breakpoint 1.1
#0: 0x00001f30 a.out`foo
a.out`foo:
-> 0x1f30: pushl %ebp
0x1f31: movl %esp, %ebp
0x1f33: pushl %eax
0x1f34: movl 8(%ebp), %eax
(lldb) x/x $esp+4
0xbffffbf0: 0x0000000a
(lldb)
Run Code Online (Sandbox Code Playgroud)
括号内的括号$esp+4是保持指针算术的大小不变int *.没有这些括号,表达式将取消引用$esp+16.
上,其中参数在寄存器(x86_64的,ARMv7的,arm64对于一些数量的参数)传递平台,LLDB提供便利寄存器别名,$arg1,$arg2等,它们是很方便的对这些种断点条件.
| 归档时间: |
|
| 查看次数: |
4061 次 |
| 最近记录: |