[lldb-dev] Problems printing local variables with LLDB

Christian Schafmeister chris.schaf at verizon.net
Tue May 27 14:11:01 PDT 2014


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) 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140527/507485ce/attachment.html>


More information about the lldb-dev mailing list