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

Greg Clayton gclayton at apple.com
Tue Oct 5 20:09:11 PDT 2010


Author: gclayton
Date: Tue Oct  5 22:09:11 2010
New Revision: 115733

URL: http://llvm.org/viewvc/llvm-project?rev=115733&view=rev
Log:
Restored the ability to set the format for expressions after changing the expression results over to ValueObjectSP objects.

Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    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=115733&r1=115732&r2=115733&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct  5 22:09:11 2010
@@ -213,6 +213,18 @@
         m_update_id = LLDB_INVALID_UID;
     }
 
+    lldb::Format
+    GetFormat () const
+    {
+        return m_format;
+    }
+    
+    void
+    SetFormat (lldb::Format format)
+    {
+        m_format = format;
+    }
+
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from ValueObject can see and modify these
@@ -236,6 +248,7 @@
     std::vector<lldb::ValueObjectSP> m_children;
     std::map<ConstString, lldb::ValueObjectSP> m_synthetic_children;
     lldb::ValueObjectSP m_dynamic_value_sp;
+    lldb::Format        m_format;
     bool                m_value_is_valid:1,
                         m_value_did_change:1,
                         m_children_count_valid:1,

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=115733&r1=115732&r2=115733&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Oct  5 22:09:11 2010
@@ -237,6 +237,9 @@
     assert (result_valobj_sp.get());
     if (result_valobj_sp->GetError().Success())
     {
+        if (m_options.format != eFormatDefault)
+            result_valobj_sp->SetFormat (m_options.format);
+
         ValueObject::DumpValueObject (output_stream,
                                       m_exe_ctx.GetBestExecutionContextScope(),
                                       result_valobj_sp.get(),   // Variable object to dump

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=115733&r1=115732&r2=115733&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Oct  5 22:09:11 2010
@@ -56,6 +56,8 @@
     m_object_desc_str (),
     m_children (),
     m_synthetic_children (),
+    m_dynamic_value_sp (),
+    m_format (eFormatDefault),
     m_value_is_valid (false),
     m_value_did_change (false),
     m_children_count_valid (false),
@@ -584,16 +586,18 @@
                         if (clang_type)
                         {
                             StreamString sstr;
-                            lldb::Format format = ClangASTType::GetFormat(clang_type);
-                            if (ClangASTType::DumpTypeValue(GetClangAST(),            // The clang AST
-                                                                clang_type,               // The clang type to display
-                                                                &sstr,
-                                                                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"
-                                                                GetBitfieldBitSize(),     // Bitfield bit size
-                                                                GetBitfieldBitOffset()))  // Bitfield bit offset
+                            if (m_format == eFormatDefault)
+                                m_format = ClangASTType::GetFormat(clang_type);
+
+                            if (ClangASTType::DumpTypeValue (GetClangAST(),            // The clang AST
+                                                             clang_type,               // The clang type to display
+                                                             &sstr,
+                                                             m_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"
+                                                             GetBitfieldBitSize(),     // Bitfield bit size
+                                                             GetBitfieldBitOffset()))  // Bitfield bit offset
                                 m_value_str.swap(sstr.GetString());
                             else
                                 m_value_str.clear();





More information about the lldb-commits mailing list