[lldb-dev] Dereferencing SBValue

Eran Ifrah eran.ifrah at gmail.com
Sun Apr 20 12:57:56 PDT 2014


On Sun, Apr 20, 2014 at 7:26 PM, Greg Clayton <gclayton at apple.com> wrote:

> You don't need to deref a pointer. You can just ask it how many children
> it has.
>
> I am guessing you have a pointer that is using a forward declaration:
>
> ​This probably it
​

> class foo;
> foo *foo = ...
>
> Many compilers don't emit a full definition for the class in this case.
> Smart pointers often run into this. LLDB will try to track down a complete
> definition of your type elsewhere, but I am guessing there simply isn't one
> in the debug info.
>
> Compilers often have some settings to control how much debug info does or
> does not get emitted, so you might check your compiler options. But these
> options tend to really bloat the debug info if you disable the settings
> which limit the debug info.
>
> So to recap:
> 1 - don't do anything special for pointers, just ask them how many
> children they have and to get child at index
> 2 - many times there aren't full definitions for types when a forward
> declared pointer is used
>
> Greg
>
> ​So basically, pointers are being de-referenced automatically and I should
do nothing special to handle this
Thanks for the clarifications!
​

>
> On Apr 19, 2014, at 6:09 AM, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>
> Hello list,
>
>  I am trying to de-reference a pointer type without success, i.e. I
> successfully that I need to perform a de-reference but the results are the
> same
>
> here is the code logic I am using (value is of type SBValue):
>
> lldb::TypeClass typeClass = value.GetType().GetTypeClass();
>  if ( typeClass & lldb::eTypeClassPointer ) {
>     value = value.Dereference();
> }
>
> int numOfChildren = value.GetNumChildren();
>
> // numOfChildren is 0
>
> Even when the above condition is True, the number of children remain 0
>
> Here is a screenshot of the debug process (I marked in RED what should
> have been de-referenced):
>http://codelite.org/images/tmp/de-reference.png​
>
> What am I am missing?​
>
> ​Thanks!​
>
> --
> 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/20140420/9667b741/attachment.html>


More information about the lldb-dev mailing list