summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-12-08 19:44:08 +0000
committerJim Ingham <jingham@apple.com>2011-12-08 19:44:08 +0000
commit60dbabbaa706c4fffb879ce71a6e023670490c2c (patch)
tree14eee208213094ca6684521fb34615a9a523ff31
parent6ccae15ef0b96b1b4db642020a249bb9cff204df (diff)
downloadbcm5719-llvm-60dbabbaa706c4fffb879ce71a6e023670490c2c.tar.gz
bcm5719-llvm-60dbabbaa706c4fffb879ce71a6e023670490c2c.zip
Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069> llvm-svn: 146173
-rw-r--r--lldb/include/lldb/API/SBValue.h9
-rw-r--r--lldb/include/lldb/Core/ValueObject.h3
-rw-r--r--lldb/include/lldb/Core/ValueObjectDynamicValue.h6
-rw-r--r--lldb/scripts/Python/interface/SBValue.i9
-rw-r--r--lldb/source/API/SBValue.cpp44
-rw-r--r--lldb/source/Core/ValueObject.cpp6
-rw-r--r--lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py9
7 files changed, 86 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 72eb65f9841..f9e70994380 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -84,6 +84,15 @@ public:
const char *
GetObjectDescription ();
+
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
const char *
GetLocation ();
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index 8ea9e397498..22c08a06d66 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -725,6 +725,9 @@ public:
lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
+ virtual lldb::ValueObjectSP
+ GetStaticValue ();
+
lldb::ValueObjectSP
GetSyntheticValue (lldb::SyntheticValueType use_synthetic);
diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 85c604df91d..f28bc65f58e 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -73,6 +73,12 @@ public:
return NULL;
}
+ virtual lldb::ValueObjectSP
+ GetStaticValue ()
+ {
+ return m_parent->GetSP();
+ }
+
void
SetOwningSP (lldb::ValueObjectSP &owning_sp)
{
diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i
index 39a92c6503e..a1ab884c589 100644
--- a/lldb/scripts/Python/interface/SBValue.i
+++ b/lldb/scripts/Python/interface/SBValue.i
@@ -118,6 +118,15 @@ public:
const char *
GetObjectDescription ();
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
+
const char *
GetLocation ();
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 6ef4c387258..c7ab54999ca 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -597,6 +597,50 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
}
lldb::SBValue
+SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue (m_opaque_sp->GetDynamicValue(use_dynamic));
+ }
+ }
+
+ return SBValue();
+}
+
+lldb::SBValue
+SBValue::GetStaticValue ()
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue(m_opaque_sp->GetStaticValue());
+ }
+ }
+
+ return SBValue();
+}
+
+bool
+SBValue::IsDynamic()
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return m_opaque_sp->IsDynamic();
+ }
+ }
+ return false;
+}
+
+lldb::SBValue
SBValue::GetValueForExpressionPath(const char* expr_path)
{
lldb::ValueObjectSP child_sp;
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index d643a5308b5..b4331144c7d 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1920,6 +1920,12 @@ ValueObject::GetDynamicValue (DynamicValueType use_dynamic)
return ValueObjectSP();
}
+ValueObjectSP
+ValueObject::GetStaticValue()
+{
+ return GetSP();
+}
+
// GetDynamicValue() returns a NULL SharedPointer if the object is not dynamic
// or we do not really want a dynamic VO. this method instead returns this object
// itself when making it synthetic has no meaning. this makes it much simpler
diff --git a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py
index f291f037240..f427dae4f1b 100644
--- a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py
+++ b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py
@@ -153,6 +153,15 @@ class DynamicValueTestCase(TestBase):
this_dynamic = frame.FindVariable ('this', use_dynamic)
self.examine_value_object_of_this_ptr (this_static, this_dynamic, myB_loc)
+ # Now make sure that the "GetDynamicValue" works:
+ # This doesn't work currently because we can't get dynamic values from ConstResult objects.
+ fetched_dynamic_value = this_static.GetDynamicValue(use_dynamic)
+ self.examine_value_object_of_this_ptr (this_static, fetched_dynamic_value, myB_loc)
+
+ # And conversely that the GetDynamicValue() interface also works:
+ fetched_static_value = this_dynamic.GetStaticValue()
+ self.examine_value_object_of_this_ptr (fetched_static_value, this_dynamic, myB_loc)
+
# Get "this" using FindValue, make sure that works too:
this_static = frame.FindValue ('this', lldb.eValueTypeVariableArgument, no_dynamic)
this_dynamic = frame.FindValue ('this', lldb.eValueTypeVariableArgument, use_dynamic)
OpenPOWER on IntegriCloud