[lldb-dev] Watching the current frame locals

Eran Ifrah eran.ifrah at gmail.com
Sun Apr 6 07:02:02 PDT 2014

Hello all,

I am at a phase where I want to display the current frame local variables
whenever the debugger "stops"
I was able to get a list of the selected frame's variables in the following

lldb::SBFrame frame =
lldb::SBValueList args = frame.GetBlock().GetVariables(m_target, true,
true, false);
for(size_t i=0; i<args.GetSize(); ++i) {
        lldb::SBValue value = args.GetValueAtIndex(i);
        if ( value.IsValid() ) {
            LLDBLocalVariable::Ptr_t var( new LLDBLocalVariable(value) );
            locals.push_back( var );

Now, LLDBLocalVariable is a thin wrapper class for UI purposes.
What it does is basically copies values from lldb::SBValue:

LLDBLocalVariable::LLDBLocalVariable(lldb::SBValue value) {
    SetName( value.GetName() );
    SetType( value.GetTypeName() );
    SetValue( value.GetValue() ); // always returns null
    ... // code that handles children of value

value.GetName() and value.GetTypeName() are working as expected (i.e. I get
the correct type name and its name)
However, I can't get the value as "string". I was naive enough to think
that const char* SBValue::GetValue() will do the trick... but this always
returns NULL.

Any suggestions on what am I doing wrong? an example on how to extract the
variable's value in string format will be really appreciated


This is Linux 13.10 / 64 bit
Self compiled lldb

Eran Ifrah
Author of codelite, a cross platform open source C/C++ IDE:
wxCrafter, a wxWidgets RAD: http://wxcrafter.codelite.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140406/3486e5aa/attachment.html>

More information about the lldb-dev mailing list