如何显示 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;
}
在使用
lldb
进行调试时,我想为每个步骤显示上面 print_all_variables() 例程中所有变量的值
最佳答案
这个 lldb 命令应该可以解决问题:
target stop-hook add --one-liner "frame variable"
例子:
(lldb) b print_all_variables
断点 2: where = stophook`print_all_variables + 10 at main.c:14, address = 0x0000000100000eca
(lldb) target stop-hook add --one-liner "frame variable"
停止钩 #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) 我 = 0
(lldb)
关于c - 显示 lldb 中每一步的所有帧变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20590855/