[lldb-dev] Dereferencing SBValue

Greg Clayton gclayton at apple.com
Sun Apr 20 09:26:23 PDT 2014


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:

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


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140420/436aa937/attachment.html>


More information about the lldb-dev mailing list