[Lldb-commits] [lldb] r219423 - Add an API on ValueObject to retrieve the desired dynamic/synthetic combination all at once, if available, working somewhat hard to avoid returning an invalid ValueObject in the process

Enrico Granata egranata at apple.com
Thu Oct 9 11:24:30 PDT 2014


Author: enrico
Date: Thu Oct  9 13:24:30 2014
New Revision: 219423

URL: http://llvm.org/viewvc/llvm-project?rev=219423&view=rev
Log:
Add an API on ValueObject to retrieve the desired dynamic/synthetic combination all at once, if available, working somewhat hard to avoid returning an invalid ValueObject in the process

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=219423&r1=219422&r2=219423&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Oct  9 13:24:30 2014
@@ -708,6 +708,10 @@ public:
     virtual bool
     IsSynthetic() { return false; }
     
+    lldb::ValueObjectSP
+    GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue,
+                                           bool synthValue);
+    
     virtual lldb::ValueObjectSP
     CreateConstantValue (const ConstString &name);
 

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=219423&r1=219422&r2=219423&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Oct  9 13:24:30 2014
@@ -3551,6 +3551,56 @@ ValueObject::CreateConstantValue (const
     return valobj_sp;
 }
 
+ValueObjectSP
+ValueObject::GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue,
+                                                    bool synthValue)
+{
+    ValueObjectSP result_sp(GetSP());
+    
+    switch (dynValue)
+    {
+        case lldb::eDynamicCanRunTarget:
+        case lldb::eDynamicDontRunTarget:
+        {
+            if (!result_sp->IsDynamic())
+            {
+                if (result_sp->GetDynamicValue(dynValue))
+                    result_sp = result_sp->GetDynamicValue(dynValue);
+            }
+        }
+            break;
+        case lldb::eNoDynamicValues:
+        default:
+        {
+            if (result_sp->IsDynamic())
+            {
+                if (result_sp->GetStaticValue())
+                    result_sp = result_sp->GetStaticValue();
+            }
+        }
+            break;
+    }
+    
+    if (synthValue)
+    {
+        if (!result_sp->IsSynthetic())
+        {
+            if (result_sp->GetSyntheticValue())
+                result_sp = result_sp->GetSyntheticValue();
+        }
+    }
+    else
+    {
+        if (result_sp->IsSynthetic())
+        {
+            if (result_sp->GetNonSyntheticValue())
+                result_sp = result_sp->GetNonSyntheticValue();
+        }
+    }
+    
+    return result_sp;
+}
+
 lldb::addr_t
 ValueObject::GetCPPVTableAddress (AddressType &address_type)
 {





More information about the lldb-commits mailing list