Improvements to the ValueObjectPrinter to behave correctly in more dynamic value...
authorEnrico Granata <egranata@apple.com>
Tue, 22 Oct 2013 22:42:14 +0000 (22:42 +0000)
committerEnrico Granata <egranata@apple.com>
Tue, 22 Oct 2013 22:42:14 +0000 (22:42 +0000)
llvm-svn: 193204

lldb/source/DataFormatters/ValueObjectPrinter.cpp

index fd53a34..93d7a05 100644 (file)
@@ -99,17 +99,38 @@ ValueObjectPrinter::GetDynamicValueIfNeeded ()
         return true;
     bool update_success = m_orig_valobj->UpdateValueIfNeeded (true);
     if (!update_success)
-        return false;
-    if (options.m_use_dynamic != eNoDynamicValues)
     {
-        ValueObject *dynamic_value = m_orig_valobj->GetDynamicValue(options.m_use_dynamic).get();
-        if (dynamic_value)
-            m_valobj = dynamic_value;
-        else
-            m_valobj = m_orig_valobj;
+        m_valobj = m_orig_valobj;
     }
     else
-        m_valobj = m_orig_valobj;
+    {
+        if (m_orig_valobj->IsDynamic())
+        {
+            if (options.m_use_dynamic == eNoDynamicValues)
+            {
+                ValueObject *static_value = m_orig_valobj->GetStaticValue().get();
+                if (static_value)
+                    m_valobj = static_value;
+                else
+                    m_valobj = m_orig_valobj;
+            }
+            else
+                m_valobj = m_orig_valobj;
+        }
+        else
+        {
+            if (options.m_use_dynamic != eNoDynamicValues)
+            {
+                ValueObject *dynamic_value = m_orig_valobj->GetDynamicValue(options.m_use_dynamic).get();
+                if (dynamic_value)
+                    m_valobj = dynamic_value;
+                else
+                    m_valobj = m_orig_valobj;
+            }
+            else
+                m_valobj = m_orig_valobj;
+        }
+    }
     m_clang_type = m_valobj->GetClangType();
     m_type_flags = m_clang_type.GetTypeInfo ();
     return true;