summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBValue.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-04-16 00:01:13 +0000
committerJim Ingham <jingham@apple.com>2011-04-16 00:01:13 +0000
commit78a685aa2d8bbf48f25f2f93d4c0a74652eb0e9b (patch)
treebccc15a9b0e04bef29c0d2ceeb85a3c355dc9586 /lldb/source/API/SBValue.cpp
parentf46b33852c0294f1dba3303c6810902212fe749d (diff)
downloadbcm5719-llvm-78a685aa2d8bbf48f25f2f93d4c0a74652eb0e9b.tar.gz
bcm5719-llvm-78a685aa2d8bbf48f25f2f93d4c0a74652eb0e9b.zip
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. llvm-svn: 129623
Diffstat (limited to 'lldb/source/API/SBValue.cpp')
-rw-r--r--lldb/source/API/SBValue.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index a607841a527..64011789878 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -339,6 +339,13 @@ SBValue::SetValueFromCString (const char *value_str)
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 @@ SBValue::GetChildAtIndex (uint32_t idx)
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::GetIndexOfChildWithName (const char *name)
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 @@ SBValue::GetChildMemberWithName (const char *name)
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));
OpenPOWER on IntegriCloud