Dereferencing SBValue

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!​

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

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!