[Lldb-commits] [lldb] r133743 - in /lldb/trunk: include/lldb/Core/ValueObject.h source/Core/ValueObject.cpp

Greg Clayton gclayton at apple.com
Thu Jun 23 11:38:25 PDT 2011


Author: gclayton
Date: Thu Jun 23 13:38:25 2011
New Revision: 133743

URL: http://llvm.org/viewvc/llvm-project?rev=133743&view=rev
Log:
Another patch from Enrico Granata.

Added a fix for where you might have already displayed something with a given
type, then did a "type format add ...", then you display the type again. This
patch will figure out that the format changed and allow us to display the
type with the correct new format.


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=133743&r1=133742&r2=133743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Jun 23 13:38:25 2011
@@ -505,6 +505,7 @@
     ValueObject *m_deref_valobj;
 
     lldb::Format        m_format;
+    lldb::Format        m_last_format;
     bool                m_value_is_valid:1,
                         m_value_did_change:1,
                         m_children_count_valid:1,

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=133743&r1=133742&r2=133743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Jun 23 13:38:25 2011
@@ -661,6 +661,23 @@
     {
         if (UpdateValueIfNeeded())
         {
+            /*
+             this is a quick fix for the case in which we display a variable, then change its format with
+             type format add and the old display string keeps showing until one steps through the code
+             */
+            {
+                const Value::ContextType context_type = m_value.GetContextType();
+                switch (context_type)
+                {
+                    case Value::eContextTypeClangType:
+                    case Value::eContextTypeLLDBType:
+                    case Value::eContextTypeVariable:
+                        Format format = GetFormat();
+                        if (format != m_last_format)
+                            m_value_str.clear();
+                        break;
+                }
+            }
             if (m_value_str.empty())
             {
                 const Value::ContextType context_type = m_value.GetContextType();
@@ -682,7 +699,7 @@
                             if (ClangASTType::DumpTypeValue (GetClangAST(),            // The clang AST
                                                              clang_type,               // The clang type to display
                                                              &sstr,
-                                                             format,                   // Format to display this type with
+                                                             m_last_format = format,   // Format to display this type with
                                                              m_data,                   // Data to extract from
                                                              0,                        // Byte offset into "m_data"
                                                              GetByteSize(),            // Byte size of item in "m_data"





More information about the lldb-commits mailing list