Lldb C Local variable is not printed
Value eval(Value arg, Table env) {
if (arg.tag == ConsCell) {
Value operator = car(arg);
Value operands = cdr(arg); // <- debugger stopped here
If I print the argument arg
with p arg
, I get:
(lldb) p arg
(Value) $0 = {
data = {
number = 1068272
list = 0x0000000100104cf0
symbol = 0x0000000100104cf0 "?L\x10"
}
tag = ConsCell
}
But if p operator
, I get:
(lldb) p operator
error: expected a type
error: 1 errors parsing expression
However, the usage frame variable operator
works:
(lldb) frame variable operator
(Value) operator = {
data = {
number = 1068208
list = 0x0000000100104cb0
symbol = 0x0000000100104cb0 "\x10L\x10"
}
tag = ConsCell
}
What happens when I use p operator
?
source to share
lldb evaluates an expression in a C ++ / Objective-C hybrid. operator
, your variable name is a reserved keyword in C ++. When you use a command p
(which is an alias for a command expression
), lldb passes your expression to clang for parsing and evaluating in C ++ / Objective-C (or, if you are debugging a Swift method, parsing and evaluating in Swift). Even though your program is written in straightforward C, your expressions are evaluated as C ++ expressions and are not a valid C ++ expression.
frame variable
( fr v
for brevity) does not go through the compiler for evaluation, it tries to do a simple parsing of the provided variable path. It can do simple dereferencing and follow pointers, but it cannot emit values, for example.
source to share