[Lldb-commits] [lldb] r146173 - in /lldb/trunk: include/lldb/API/SBValue.h include/lldb/Core/ValueObject.h include/lldb/Core/ValueObjectDynamicValue.h scripts/Python/interface/SBValue.i source/API/SBValue.cpp source/Core/ValueObject.cpp test/lang/cpp/dynamic-value/TestDynamicValue.py
Jim Ingham
jingham at apple.com
Thu Dec 8 11:44:08 PST 2011
Author: jingham
Date: Thu Dec 8 13:44:08 2011
New Revision: 146173
URL: http://llvm.org/viewvc/llvm-project?rev=146173&view=rev
Log:
Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069>
Modified:
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Thu Dec 8 13:44:08 2011
@@ -84,6 +84,15 @@
const char *
GetObjectDescription ();
+
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
const char *
GetLocation ();
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Dec 8 13:44:08 2011
@@ -725,6 +725,9 @@
lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
+ virtual lldb::ValueObjectSP
+ GetStaticValue ();
+
lldb::ValueObjectSP
GetSyntheticValue (lldb::SyntheticValueType use_synthetic);
Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Thu Dec 8 13:44:08 2011
@@ -73,6 +73,12 @@
return NULL;
}
+ virtual lldb::ValueObjectSP
+ GetStaticValue ()
+ {
+ return m_parent->GetSP();
+ }
+
void
SetOwningSP (lldb::ValueObjectSP &owning_sp)
{
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Thu Dec 8 13:44:08 2011
@@ -118,6 +118,15 @@
const char *
GetObjectDescription ();
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
+
const char *
GetLocation ();
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu Dec 8 13:44:08 2011
@@ -597,6 +597,50 @@
}
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;
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Dec 8 13:44:08 2011
@@ -1920,6 +1920,12 @@
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
Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py Thu Dec 8 13:44:08 2011
@@ -153,6 +153,15 @@
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)
More information about the lldb-commits
mailing list