The variable has been optimized away at this point in your program. The error message from expr
/p
is a little unfortunate - there's a change in top of tree which should allow the real error to be emitted - but the behavior is correct. The frame variable
output is the correct error message.
You can always do
(lldb) image lookup -v -a $pc
to see the locations of all visible variables at a point in your program. They are expressed in the form of a DWARF expression which is usually expressed in terms of the frame base register (DW_OP_fbreg
) which is usually rbp
on x86_64 for instance.
If a variable is listed with an empty location=
field, that means that the variable's value is not available at this pc location.