[Lldb-commits] [lldb] r216483 - Add an API on ValueObject to generate a 'synthetic child' of base class type. Note that in this commit, the term synthetic child is not meant to refer to data formatters, but to the programmatically-generated children stored inside a ValueObject itself
Enrico Granata
egranata at apple.com
Tue Aug 26 13:54:05 PDT 2014
Author: enrico
Date: Tue Aug 26 15:54:04 2014
New Revision: 216483
URL: http://llvm.org/viewvc/llvm-project?rev=216483&view=rev
Log:
Add an API on ValueObject to generate a 'synthetic child' of base class type. Note that in this commit, the term synthetic child is not meant to refer to data formatters, but to the programmatically-generated children stored inside a ValueObject itself
Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=216483&r1=216482&r2=216483&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Aug 26 15:54:04 2014
@@ -677,6 +677,9 @@ public:
GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
virtual lldb::ValueObjectSP
+ GetSyntheticBase (const ClangASTType& type, bool can_create);
+
+ virtual lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
lldb::DynamicValueType
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=216483&r1=216482&r2=216483&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 26 15:54:04 2014
@@ -2215,6 +2215,48 @@ ValueObject::GetSyntheticChildAtOffset(u
return synthetic_child_sp;
}
+ValueObjectSP
+ValueObject::GetSyntheticBase (const ClangASTType& type, bool can_create)
+{
+ ValueObjectSP synthetic_child_sp;
+
+ char name_str[64];
+ snprintf(name_str, sizeof(name_str), "%s", type.GetTypeName().AsCString("<unknown>"));
+ ConstString name_const_str(name_str);
+
+ // Check if we have already created a synthetic array member in this
+ // valid object. If we have we will re-use it.
+ synthetic_child_sp = GetSyntheticChild (name_const_str);
+
+ if (synthetic_child_sp.get())
+ return synthetic_child_sp;
+
+ if (!can_create)
+ return ValueObjectSP();
+
+ const uint32_t offset = 0;
+ const bool is_base_class = true;
+
+ ValueObjectChild *synthetic_child = new ValueObjectChild(*this,
+ type,
+ name_const_str,
+ type.GetByteSize(),
+ offset,
+ 0,
+ 0,
+ is_base_class,
+ false,
+ eAddressTypeInvalid);
+ if (synthetic_child)
+ {
+ AddSyntheticChild(name_const_str, synthetic_child);
+ synthetic_child_sp = synthetic_child->GetSP();
+ synthetic_child_sp->SetName(name_const_str);
+ }
+ return synthetic_child_sp;
+}
+
+
// your expression path needs to have a leading . or ->
// (unless it somehow "looks like" an array, in which case it has
// a leading [ symbol). while the [ is meaningful and should be shown
More information about the lldb-commits
mailing list