Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
expressions that are simple enough to get passed to the "frame var" underpinnings. The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.
The behavior of "frame var" is controlled in two ways. You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.
There's also a general setting:
target.prefer-dynamic-value (boolean) = 'true'
which is consulted if you call "frame var" without supplying a value for the -d option.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129623 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index a607841..6401178 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -339,6 +339,13 @@
SBValue
SBValue::GetChildAtIndex (uint32_t idx)
{
+ bool use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
+ return GetChildAtIndex (idx, use_dynamic_value);
+}
+
+SBValue
+SBValue::GetChildAtIndex (uint32_t idx, bool use_dynamic_value)
+{
lldb::ValueObjectSP child_sp;
if (m_opaque_sp)
@@ -346,6 +353,16 @@
child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
}
+ if (use_dynamic_value)
+ {
+ if (child_sp)
+ {
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true, child_sp);
+ if (dynamic_sp)
+ child_sp = dynamic_sp;
+ }
+ }
+
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@@ -374,6 +391,13 @@
SBValue
SBValue::GetChildMemberWithName (const char *name)
{
+ bool use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTarget()->GetPreferDynamicValue();
+ return GetChildMemberWithName (name, use_dynamic_value);
+}
+
+SBValue
+SBValue::GetChildMemberWithName (const char *name, bool use_dynamic_value)
+{
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
@@ -382,6 +406,16 @@
child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
}
+ if (use_dynamic_value)
+ {
+ if (child_sp)
+ {
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true, child_sp);
+ if (dynamic_sp)
+ child_sp = dynamic_sp;
+ }
+ }
+
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));