[lldb-dev] Problems printing local variables with LLDB
jingham at apple.com
jingham at apple.com
Tue May 27 15:04:00 PDT 2014
If you don't mind letting somebody see the code in one of your bad source files, then you can preprocess a source file containing a function that shows the problem, and that plus "what function shows the missing variable" what variable was missing, and where you were in the code (line number is fine) should be enough for the compiler folks to reproduce and diagnose the problem. They don't need to build your whole app, just build that source file & look at the resultant debug info.
Jim
> On May 27, 2014, at 2:48 PM, Christian Schafmeister <chris.schaf at verizon.net> wrote:
>
>
> Thank you, it is helpful to have it confirmed that at “-O0” I should have access to my variables.
>
> Unfortunately, I’ve had this problem since I switched to LLDB two years ago and I only see it (always see it) when I’m debugging my full application (165 source files, about 150,000 lines of code). So far, my several attempts at developing small test cases have been fruitless - small examples debug fine and all variables are visible.
>
> Best,
>
> .Chris.
>
>
> On May 27, 2014, at 5:38 PM, Greg Clayton <gclayton at apple.com> wrote:
>
>> File a compiler bug with your source file. At -O0 you should always have access to your variables. LLDB is just showing you what the compiler tells us.
>>
>> Greg Clayton
>>
>>> On May 27, 2014, at 2:11 PM, Christian Schafmeister <chris.schaf at verizon.net> wrote:
>>>
>>>
>>> How do I ensure that I can print all local variables from within LLDB?
>>>
>>> When I use LLDB, more than half the time when I try to print a local variable I get an error and “frame variable” shows the variable as being <variable not available>
>>>
>>> I’m compiling all of my source with “-O0 -g”.
>>>
>>> I have not been able to create a small test case where this happens - all of my attempts at small test cases print local variables just fine.
>>>
>>> Here is a typical compiler invocation for my debug build:
>>>
>>> "clang++" -x c++ -O0 -g -Warray-bounds -Wgnu-array-member-paren-init -Wno-deprecated-register -mmacosx-version-min=10.7 -fvisibility=default -std=c++11 -stdlib=libc++ -DCONFIG_VAR_COOL -DDEBUG_ASSERTS -DDEBUG_MPS_AMS_POOL -DEXPAT -DINCLUDED_FROM_CLASP -DINHERITED_FROM_SRC -DREADLINE -DUSE_BOEHM -D_ADDRESS_MODEL_64 -D_DEBUG_BUILD -D_TARGET_OS_DARWIN -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I"../../src" -I"../../src/core" -I"../../src/core/bin/boehm/clang-darwin-4.2.1/debug/link-static" -I"/Library/Frameworks/EPD64.framework/Versions/7.2/include/python2.7" -I"/Users/meister/Development/cando/clasp/build/cando.app/Contents/Resources/externals/common/include" -I"/Users/meister/Development/cando/clasp/build/cando.app/Contents/Resources/externals/release/include" -c -o "../../src/core/bin/boehm/clang-darwin-4.2.1/debug/link-static/evaluator.o" "../../src/core/evaluator.cc"
>>>
>>>
>>> Here’s an example of what I run into all the time with LLDB:
>>>
>>> frame #12: 0x000000010119800e clasp_boehm_d`core::SpecialForm_O::evaluate(mem::smart_ptr<core::Cons_O>, mem::smart_ptr<core::Environment_O>) + 542 at /Users/meister/Development/cando/clasp/src/core/../../src/core/specialForm.cc:41
>>> 38 T_mv SpecialForm_O::evaluate( Cons_sp args, Environment_sp environment )
>>> 39 {_OF();
>>> 40 ASSERTP(this->_fptr!=NULL,"Functoid can not be NULL");
>>> -> 41 return (this->_fptr)(args,environment);
>>> 42 }
>>> 43
>>> 44
>>> (lldb) frame variable
>>> frame variable
>>> (core::SpecialForm_O *) this = 0x00000001067d4008
>>> (core::Cons_sp) args = <variable not available>
>>>
>>> (core::Environment_sp) environment = <variable not available>
>>>
>>> (lldb) print args
>>> print args
>>> error: Couldn't materialize struct: size of variable args (8) disagrees with the ValueObject's size (0)
>>> Errored out in Execute, couldn't PrepareToExecuteJITExpression
>>> (lldb)
>>>
>>>
>>>
>>> _______________________________________________
>>> lldb-dev mailing list
>>> lldb-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>>
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list