[lldb-dev] Help with C++ API

Jakob Leben jakob.leben at gmail.com
Tue Aug 27 20:48:47 PDT 2013

Hi Enrico,

On Tue, Aug 27, 2013 at 6:53 PM, Enrico Granata <egranata at apple.com> wrote:
> Do you have a test case for your issue? I would like to take a look.
> The fact that GetChildAtIndex() works is not unexpected. I would like to
> figure out why GetPointeeData() & ReadRawData() are failing.

Erm, sorry, that was my mistake! While cooking up a simple test case,
I realized I was passing size to ReadRawData as element count instead
of count * sizeof(type).

Thanks for other answers, that makes things much clearer!

Further observations that I would like to clarify:

1. Reading elements of std::list works just great using
GetNumChildren() and GetChildAtIndex() on the container, when the
container is set to use synthetic value. However the
"can_create_synthetic" argument of GetChildAtIndex() does not seem to
have any effect, contrary to what documentation suggests. Am I
misreading something or is documentation wrong? Perhaps the argument
only controls the preference of children with regard to grandchildren,
and not how children are obtained.

2. For std::vector, GetNumChildren() returns -1 (with preference for
synthetic)! However, reading children using GetChildAtIndex() etc.
still succeeds.

3. For both std::vector or std::list, I would then expect
container.GetData().GetSignedXxx(error, index) to work as well. It
fails in either case, and regardless of preference of container with
regard to synthetic values.

4. For std::string, GetNumChildren() always returns 1 regardless of
preference for synthetic values, and I haven't found any way to read
elements succesfully.

More information about the lldb-dev mailing list