[lldb-dev] Help with C++ API

Jakob Leben jakob.leben at gmail.com
Tue Aug 27 18:23:29 PDT 2013


Hello,

I have got some questions regarding the LLDB C++ API which I haven't
found answers to in the documentation or by investigating the source
code so far. If there is a better place than this mailing list to
direct this kind of questions to, please let me know!

All the questions below are related to using the API to debug a
program compiled from C++ source.

1. When trying to read data from a dynamically allocated array of
"doubles" I fail to get all the data correctly by using
SBValue::GetPointeeData() and then SBData::ReadRawData(), despite the
fact that no call reports any error, and all the involved SBxxx
objects as valid. However, if I use SBValue::GetChildAtIndex for each
array member, each member is read correctly. What's the difference? I
guess this has to do something with data caching (or lack thereof)?

2. When reading data from a dynamically allocated data structure by
using SBValue::GetChildMemberWithName() etc. on a SBValue representing
a pointer to the (complex) object, and obtained in a *different*
breakpoint callback then the current one, again reading does not fail
in any way, but the read data of any field will be equivalent to
whatever was last read in the *originating* breakpoint callback.
Probably again, only data cached when reading with the SBValue in
scope is returned. I understand that a SBValue is meant to represent a
value a particular execution context, and as such does not need to
support reading data outside of that context. But it there any other
API that would facilitate reading fields of a complex-type object on
the heap at any point in program execution, regardless of the current
execution context? It seems logical that this should be possible.

3. Despite reading the source code, I have not managed to grasp the
exact meaning of the words "dynamic" and "synthetic", whenever they
occur in the API. For example, what precisely do the
lldb::DynamicValueType flags mean? Is this related to dynamically
typed languages, or does it have to do something with caching of data
exchanged between debugger and debugee? What exactly does it imply if
I set a SBValue's "preference" to use dynamic or synthetic value?

Thank you for any answers, or directions that would help me find the
answers myself.

Best regards,
Jakob Leben



More information about the lldb-dev mailing list