<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 8, 2014 at 10:55 PM, Enrico Granata <span dir="ltr"><<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="">On Apr 8, 2014, at 12:35 PM, Eran Ifrah <<a href="mailto:eran.ifrah@gmail.com" target="_blank">eran.ifrah@gmail.com</a>> wrote:<br>

</div><div><div class=""><br><blockquote type="cite"><div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small">Thanks for the tip. It works fine for 'string' types</div><div style="font-family:verdana,sans-serif;font-size:small">



But for simple types (e.g. 'int') GetSummary() returns an empty string.. :/</div><div style="font-family:verdana,sans-serif;font-size:small"><br></div><div style="font-family:verdana,sans-serif;font-size:small">

So I ended up writing this little method:</div><div style="font-family:verdana,sans-serif;font-size:small"><a href="http://pastebin.com/pj0znv9j" target="_blank">http://pastebin.com/pj0znv9j</a><br></div></div></blockquote>

<div><br></div></div><div>IIUC your logic, you’re saying - for pointers to “char-like things”, get the summary, for anything else just get the value</div><div>That doesn’t seem right. You are going to hide the summary for classes and structs doing this, and not get anything to display since these don’t have a value</div>

<div><br></div><div>Why are you trying to coalesce value and summary instead of keeping them as two separate notions and then making print-time decisions?</div><div>In the LLDB source, there is a ValueObjectPrinter.cpp which implements the printing that you see with the frame variable command, for instance</div>

<div>That might be a useful starting point for you to look at if you’re aiming to provide “smart” printouts of data</div><div><div class="h5"><br></div></div></div></div></blockquote><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">

​The reason I did this, was that GetSummary() returns empty string in all cases except for strings, so this was an attempt to merge both columns into a single column ("Value")</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">

<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">For testing purposes, I updated my UI to include 2 separate columns "Summary" and "Value" </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">

As you can see in the attached screenshot, the "Summary"​ is always empty, except for 'string' types</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">( I don't see any summary for classes and structs )</div>

<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><font face="verdana, sans-serif"><a href="http://codelite.org/images/empty-summary.png">http://codelite.org/images/empty-summary.png</a></font><br>

</div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div dir="ltr"><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Which seems to work fine for me (ofcourse, I will know more when I upload the pre-release to my testers)</font></div>



<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Thanks</font></div><div><font face="verdana, sans-serif"><br>
</font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 8, 2014 at 9:04 PM,  <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



That is what the Summary is for.  The Summary, if it exists, is the preferred "interpreted" presentation of the data held by the SBValue.  So for a char *, the Value is the pointer value, but the Summary is the c-string contents.<br>




<br>
Jim<br>
<div><div><br>
On Apr 8, 2014, at 10:57 AM, Eran Ifrah <<a href="mailto:eran.ifrah@gmail.com" target="_blank">eran.ifrah@gmail.com</a>> wrote:<br>
<br>
> Hello Enrico / All,<br>
><br>
> I debugged it and it seems like a bug in my code.<br>
> To get the frame locals (function args and locals) I was using this call:<br>
><br>
> frame.GetBlock().GetVariables()<br>
><br>
> While I should have simply call to frame.GetVariables()<br>
> Which fixes the problem.<br>
><br>
> However, I am facing another issue:<br>
> It seems like the function "const char* SBValue::GetValue()" returns the pointer address as string instead of the actual content<br>
><br>
> Any quick way to get the data as an actual c-str?<br>
><br>
> For example:<br>
><br>
> int main(int argc, char** argv) {<br>
> return 0;<br>
> }<br>
><br>
> My lldb UI for the "locals" view looks like this (best viewed in monospace font ;)) :<br>
><br>
> --------------------------------------------------------------------------------<br>
> name             | type          | value<br>
> --------------------------------------------------------------------------------<br>
> argc             | int           | 1<br>
> argv             | const char**  | 0xfffffab123 (some random address)<br>
>    |             |               |<br>
>    +-*argv       | const char*   | 0xfffffab124 (some other address)<br>
>         |        |               |<br>
>         +- **argv| char          | '/'<br>
><br>
> In the code, I can identify that *argv is of type lldb::eBasicType*Char, however, I can't find a way to extract the string itself (it should be "/home/eran/test/TestLLDB")<br>
><br>
> Any hints?<br>
><br>
> Thanks!<br>
><br>
><br>
><br>
><br>
> On Mon, Apr 7, 2014 at 5:31 AM, Eran Ifrah <<a href="mailto:eran.ifrah@gmail.com" target="_blank">eran.ifrah@gmail.com</a>> wrote:<br>
> Thanks, will debug this and see where it fails<br>
><br>
> Eran<br>
><br>
><br>
> On Mon, Apr 7, 2014 at 1:43 AM, Enrico Granata <<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>> wrote:<br>
> Yeah the const char* definitely should have a value.<br>
> I am guessing the variable is in scope all right. Does it have a summary if you ask for that?<br>
> Does the same API call work if you stop directly within LLDB and use the Python API?<br>
> 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<br>




><br>
> Sent from the iPhone of<br>
> Enrico Granata <egranata@🍎.com><br>
><br>
> On Apr 6, 2014, at 12:26 PM, Eran Ifrah <<a href="mailto:eran.ifrah@gmail.com" target="_blank">eran.ifrah@gmail.com</a>> wrote:<br>
><br>
>> One of the local variables was 'const char*' so I would expect it to have a value and others were of type of 'wxString'<br>
>> In the UI I expanded all the way to the _M_data which is of type 'wchar_t*' - and still nothing<br>
>><br>
>> Eran<br>
>><br>
>><br>
>><br>
>> On Sun, Apr 6, 2014 at 9:13 PM, Enrico Granata <<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>> wrote:<br>
>> What is the data type of your variables?<br>
>><br>
>> If they are aggregate types (structs, classes, ...) they won't have a value.<br>
>><br>
>> Only basic types (int, float, char, ..., you get the idea - and pointers) have a value.<br>
>><br>
>> For other types, they might have a summary, or they might have children, but definitely no value.<br>
>><br>
>> Sent from the iPhone of<br>
>> Enrico Granata <egranata@🍎.com><br>
>><br>
>> On Apr 6, 2014, at 7:02 AM, Eran Ifrah <<a href="mailto:eran.ifrah@gmail.com" target="_blank">eran.ifrah@gmail.com</a>> wrote:<br>
>><br>
>>> Hello all,<br>
>>><br>
>>> I am at a phase where I want to display the current frame local variables whenever the debugger "stops"<br>
>>> I was able to get a list of the selected frame's variables in the following manner:<br>
>>><br>
>>> lldb::SBFrame frame = m_target.GetProcess().GetSelectedThread().GetSelectedFrame();<br>
>>> ...<br>
>>> lldb::SBValueList args = frame.GetBlock().GetVariables(m_target, true, true, false);<br>
>>> for(size_t i=0; i<args.GetSize(); ++i) {<br>
>>>         lldb::SBValue value = args.GetValueAtIndex(i);<br>
>>>         if ( value.IsValid() ) {<br>
>>>             LLDBLocalVariable::Ptr_t var( new LLDBLocalVariable(value) );<br>
>>>             locals.push_back( var );<br>
>>>         }<br>
>>> }<br>
>>><br>
>>> Now, LLDBLocalVariable is a thin wrapper class for UI purposes.<br>
>>> What it does is basically copies values from lldb::SBValue:<br>
>>><br>
>>> LLDBLocalVariable::LLDBLocalVariable(lldb::SBValue value) {<br>
>>>     SetName( value.GetName() );<br>
>>>     SetType( value.GetTypeName() );<br>
>>>     SetValue( value.GetValue() ); // always returns null<br>
>>>     ... // code that handles children of value<br>
>>> }<br>
>>><br>
>>> value.GetName() and value.GetTypeName() are working as expected (i.e. I get the correct type name and its name)<br>
>>> 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.<br>
>>><br>
>>> 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<br>
>>><br>
>>> Thanks,<br>
>>><br>
>>> P.S.<br>
>>> This is Linux 13.10 / 64 bit<br>
>>> Self compiled lldb<br>
>>><br>
>>> --<br>
>>> Eran Ifrah<br>
>>> Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org/" target="_blank">http://www.codelite.org</a><br>
>>> wxCrafter, a wxWidgets RAD: <a href="http://wxcrafter.codelite.org/" target="_blank">http://wxcrafter.codelite.org</a><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> Eran Ifrah<br>
>> Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org/" target="_blank">http://www.codelite.org</a><br>
>> wxCrafter, a wxWidgets RAD: <a href="http://wxcrafter.codelite.org/" target="_blank">http://wxcrafter.codelite.org</a><br>
><br>
><br>
><br>
> --<br>
> Eran Ifrah<br>
> Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org/" target="_blank">http://www.codelite.org</a><br>
> wxCrafter, a wxWidgets RAD: <a href="http://wxcrafter.codelite.org/" target="_blank">http://wxcrafter.codelite.org</a><br>
><br>
><br>
><br>
> --<br>
> Eran Ifrah<br>
> Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org/" target="_blank">http://www.codelite.org</a><br>
> wxCrafter, a wxWidgets RAD: <a href="http://wxcrafter.codelite.org/" target="_blank">http://wxcrafter.codelite.org</a><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Eran Ifrah<br>Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org/" target="_blank">http://www.codelite.org</a><br>



<div>wxCrafter, a wxWidgets RAD: http://<a href="http://wxcrafter.codelite.org/" target="_blank">wxcrafter.codelite.org</a></div></div>
</div>
</blockquote></div></div></div><br><div class=""><div>
<div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px"><div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px">

<div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px"><div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px">

<div><i>- Enrico</i><br>📩 egranata@<font color="#ff2600"></font>.com ☎️ 27683</div><div><br></div></div></div></div></div><br>
</div>
<br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Eran Ifrah<br>Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org" target="_blank">http://www.codelite.org</a><br>

<div>wxCrafter, a wxWidgets RAD: http://<a href="http://wxcrafter.codelite.org" target="_blank">wxcrafter.codelite.org</a></div></div>
</div></div>