[lldb-dev] Watching the current frame locals
Enrico Granata
egranata at apple.com
Sun Apr 6 15:43:34 PDT 2014
Yeah the const char* definitely should have a value.
I am guessing the variable is in scope all right. Does it have a summary if you ask for that?
Does the same API call work if you stop directly within LLDB and use the Python API?
More context (e.g. a repro case) would also help - or maybe if you can step through the LLDB code and see where we fail. If these are just frame locals I expect the relevant code to be in ValueObject.cpp GetValueAsCString
Sent from the iPhone of
Enrico Granata <egranata@🍎.com>
> On Apr 6, 2014, at 12:26 PM, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>
> One of the local variables was 'const char*' so I would expect it to have a value and others were of type of 'wxString'
> In the UI I expanded all the way to the _M_data which is of type 'wchar_t*' - and still nothing
>
> Eran
>
>
>
>> On Sun, Apr 6, 2014 at 9:13 PM, Enrico Granata <egranata at apple.com> wrote:
>> What is the data type of your variables?
>>
>> If they are aggregate types (structs, classes, ...) they won't have a value.
>>
>> Only basic types (int, float, char, ..., you get the idea - and pointers) have a value.
>>
>> For other types, they might have a summary, or they might have children, but definitely no value.
>>
>> Sent from the iPhone of
>> Enrico Granata <egranata@🍎.com>
>>
>>> On Apr 6, 2014, at 7:02 AM, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>>>
>>> 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 manner:
>>>
>>> lldb::SBFrame frame = m_target.GetProcess().GetSelectedThread().GetSelectedFrame();
>>> ...
>>> 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
>>>
>>> Thanks,
>>>
>>> P.S.
>>> This is Linux 13.10 / 64 bit
>>> Self compiled lldb
>>>
>>> --
>>> Eran Ifrah
>>> Author of codelite, a cross platform open source C/C++ IDE: http://www.codelite.org
>>> wxCrafter, a wxWidgets RAD: http://wxcrafter.codelite.org
>>> _______________________________________________
>>> lldb-dev mailing list
>>> lldb-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
>
> --
> Eran Ifrah
> Author of codelite, a cross platform open source C/C++ IDE: http://www.codelite.org
> 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/dd4134fb/attachment.html>
More information about the lldb-dev
mailing list