我试图弄清楚程序中哪些变量为空。不幸的是lldb告诉我,当我尝试构建它时,它不能实现结构。任何想法我如何让lldb打印结构的地址(但不是结构)?
(lldb) print *arg3
error: Couldn't materialize struct: size of variable arg3 (8) disagrees with the ValueObject's size (0)
Errored out in Execute, couldn't PrepareToExecuteJITExpression
(lldb) print (int*) arg3
error: Couldn't materialize struct: size of variable arg3 (8) disagrees with the ValueObject's size (0)
Errored out in Execute, couldn't PrepareToExecuteJITExpression
(lldb) frame variable
(td_val_t *) out = 0x00007fff5fbfe5e8
(char *) fname = 0x00000001000029b0 "bokeh_wrap.visualize"
(td_val_t *) arg1 = <variable not available>
(td_val_t *) arg2 = <variable not available>
(td_val_t *) arg3 = <variable not available>
(PyObject *) pArgs = 0x00000001073cd1e0
(lldb) print @arg1
error: unexpected '@' in program
error: 1 errors parsing expression
(lldb) expr arg1
error: Couldn't materialize struct: size of variable arg1 (8) disagrees with the ValueObject's size (0)
Errored out in Execute, couldn't PrepareToExecuteJITExpression
(lldb) expr &arg1
error: Couldn't materialize struct: size of variable arg1 (8) disagrees with the ValueObject's size (0)
Errored out in Execute, couldn't PrepareToExecuteJITExpression
答案 0 :(得分:1)
您的arg变量不可用 - 这意味着LLDB不知道其中任何一个位于何处
因此,简短的回答是“不,你运气不好”。有人可能会调查你的源代码/编译器设置,以检查它们为什么不可用(超出该位置的范围?DWARF只是省略了它们,因为它们被优化了?),但是就目前而言,我们不知道变量在哪里,我们无法告诉你。
更长的答案:您正在构建优化吗?有没有机会你可以在-O0建立并仍然有bug重现?如果是这样,那就是你的解决方案
如果这只是在优化代码中重现,那么可能是时候查看汇编代码(LLDB有一个反汇编命令),并试图弄清楚程序从哪里访问arg变量(寄存器与某些内存位置)和手动发出该位置的内存读取/寄存器读取,然后通过检查从那里取出