C 显示lldb中每个步骤的所有帧变量
如何显示C 显示lldb中每个步骤的所有帧变量,c,gdb,lldb,C,Gdb,Lldb,如何显示lldb中每个步骤的所有帧变量 例如,我在C int print_all_variables(int a, int b) { int x = 10, i; for (i = 0; i < 10; i++) { x = a + b + x; b++; x++; } return x; } int 打印所有变量(int a、int b) { int x=10,i; 对于(i=0;i
lldb
中每个步骤的所有帧变量
例如,我在C
int
print_all_variables(int a, int b)
{
int x = 10, i;
for (i = 0; i < 10; i++) {
x = a + b + x;
b++;
x++;
}
return x;
}
int
打印所有变量(int a、int b)
{
int x=10,i;
对于(i=0;i<10;i++){
x=a+b+x;
b++;
x++;
}
返回x;
}
在使用
lldb
进行调试时,我想在上面的print\u all\u variables()例程中为每个步骤显示所有变量的值。此lldb命令应该可以实现以下功能:
target stop-hook add --one-liner "frame variable"
例如:
(lldb) b print_all_variables
Breakpoint 2: where = stophook`print_all_variables + 10 at main.c:14, address = 0x0000000100000eca
(lldb) target stop-hook add --one-liner "frame variable"
Stop hook #1 added.
(lldb) c
Process 4838 resuming
(int) a = 10
(int) b = 20
(int) x = 32767
(int) i = 1606416664
(lldb) n
(int) a = 10
(int) b = 20
(int) x = 10
(int) i = 1606416664
(lldb) n
(int) a = 10
(int) b = 20
(int) x = 10
(int) i = 0
(lldb)
(lldb)b打印所有变量
断点2:where=stophook`print\u所有变量+10在main.c:14,地址=0x0000000100000eca
(lldb)目标停止钩添加——一行“帧变量”
增加了1个止动钩。
(lldb)c
进程4838恢复
(int)a=10
(int)b=20
(int)x=32767
(int)i=1606416664
(lldb)n
(int)a=10
(int)b=20
(int)x=10
(int)i=1606416664
(lldb)n
(int)a=10
(int)b=20
(int)x=10
(int)i=0
(lldb)
这可以方便地在一个命令中完成所有操作:
make && chmod 755 your_program && lldb -s <(echo 'target stop-hook add --one-liner "frame variable"') your_program your_program_s_arguments
make&&chmod 755您的程序&lldb-s