[lldb-dev] Detection of expression language

Richard Mitton richard at codersnotes.com
Thu Oct 3 17:00:25 PDT 2013


Hi all,

The following code fails when asking lldb to run the command "(lldb) 
expr id"
     int main() {
         int id = 4;
         return 0;
     }

The reason is because lldb tries to evaluate the expression as Objective 
C++, rather than C. And in Objective C++, "id" is a builtin type, and so 
conflicts with our local variable.

I'm thinking the correct fix is to evaluate expressions in the language 
of the current scope, but I just wanted to throw this out there and 
check before I go off and try to fix it.

One possible problem of using the current scope's language is that if 
you had a program that mixed languages (e.g. C++ and ObjC in different 
files), you wouldn't be able to evaluate any ObjC expressions while you 
were in a C++ function.

-- 
Richard Mitton
richard at codersnotes.com




More information about the lldb-dev mailing list