Reputation: 2082
I'm trying to figure out which of several variables are null in a program. Unfortunately lldb just tells me it can't materialize the struct when I try to build it. Any ideas how I get lldb to print the address of the struct (but not the struct)?
(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
Upvotes: 1
Views: 1378
Reputation: 3329
Your arg variables are not available - that means that LLDB has no clue where any of them are located
Hence, the short answer would be "no, you're out of luck". One might investigate your source code/compiler settings to check why they would be unavailable (out of scope at that location? DWARF simply omitted them because they were optimized out?), but as it stands, we don't know where the variable is, we can't tell you about it.
Longer answer: are you building optimized? Any chance you can build at -O0 and still have the bug reproduce? If so, there's your solution
If this only reproduces in optimized code, it might be time to look at assembly code (LLDB has a disassemble command), and try to figure out where your program is accessing the arg variables from (registers vs some memory location) and manually issue a memory read/register read for that location, then take it from there with your inspection
Upvotes: 1