LLDB prints a variable called class

I have a C program that uses a variable with a name class.

I am trying to debug it with LLDB, but I ran into the following problem:

(lldb) print class
error: warning: declaration does not declare anything
error: declaration of anonymous class must be a definition
error: 1 errors parsing expression

I believe this problem occurs because it classis a reserved keyword in C ++, and LLDB interprets the code passed in printas C ++. Is there a way to print the contents of my variable?

(Please do not advise me to rename the variable, I would invent it myself if it was possible)

+4
source share
1 answer

, lldb expression ++ . ++, , , "" ++. - clang, "C ", C.

, "", "frame variable", ..:

(lldb) frame variable class

"frame variable" , , . . "" - , , target variable.

frame variable " " , :

(lldb) frame variable class.member

(lldb) frame variable *class

.

, :

(lldb) frame variable -L class

. - ,

 (TypeOfClass *) <Address From Frame Variable>

"". , "$" . , , :

(lldb) expr TypeOfClass *$class = (TypeOfClass *) <Address From Frame Variable>

$class . , Python, ...

+7

All Articles