[Lldb-commits] [lldb] r178044 - Our commands that end up displaying a ValueObject as part of their workflow use OptionGroupValueObjectDisplay as their currency for deciding the final representation

Enrico Granata egranata at apple.com
Tue Mar 26 11:04:54 PDT 2013


Author: enrico
Date: Tue Mar 26 13:04:53 2013
New Revision: 178044

URL: http://llvm.org/viewvc/llvm-project?rev=178044&view=rev
Log:
Our commands that end up displaying a ValueObject as part of their workflow use OptionGroupValueObjectDisplay as their currency for deciding the final representation
ValueObjects themselves use DumpValueObjectOptions as the currency for the same purpose

The code to convert between these two units was replicated (to varying degrees of correctness) in several spots in the code
This checkin provides one and only one (and hopefully correct :-) entry point for this conversion


Modified:
    lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Tue Mar 26 13:04:53 2013
@@ -14,6 +14,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/ValueObject.h"
 #include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
@@ -60,6 +61,11 @@ public:
                be_raw == true ||
                ignore_cap == true;
     }
+    
+    ValueObject::DumpValueObjectOptions
+    GetAsDumpOptions (bool objc_is_compact = false,
+                      lldb::Format format = lldb::eFormatDefault,
+                      lldb::TypeSummaryImplSP summary_sp = lldb::TypeSummaryImplSP());
 
     bool show_types;
     uint32_t no_summary_depth;

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Mar 26 13:04:53 2013
@@ -386,27 +386,7 @@ CommandObjectExpression::EvaluateExpress
                     if (format != eFormatDefault)
                         result_valobj_sp->SetFormat (format);
 
-                    ValueObject::DumpValueObjectOptions options;
-                    options.SetMaximumPointerDepth(m_varobj_options.ptr_depth);
-                    if (m_varobj_options.use_objc)
-                        options.SetShowSummary(false);
-                    else
-                        options.SetOmitSummaryDepth(m_varobj_options.no_summary_depth);
-                    options.SetMaximumDepth(m_varobj_options.max_depth)
-                           .SetShowTypes(m_varobj_options.show_types)
-                           .SetShowLocation(m_varobj_options.show_location)
-                           .SetUseObjectiveC(m_varobj_options.use_objc)
-                           .SetUseDynamicType(m_varobj_options.use_dynamic)
-                           .SetUseSyntheticValue(m_varobj_options.use_synth)
-                           .SetFlatOutput(m_varobj_options.flat_output)
-                           .SetIgnoreCap(m_varobj_options.ignore_cap)
-                           .SetFormat(format)
-                           .SetHideRootType(m_varobj_options.use_objc)
-                           .SetHideName(m_varobj_options.use_objc)
-                           .SetHideValue(m_varobj_options.use_objc);
-                    
-                    if (m_varobj_options.be_raw)
-                        options.SetRawDisplay(true);
+                    ValueObject::DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(true,format));
 
                     ValueObject::DumpValueObject (*(output_stream),
                                                   result_valobj_sp.get(),   // Variable object to dump

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Mar 26 13:04:53 2013
@@ -374,22 +374,7 @@ protected:
         else if (!m_option_variable.summary_string.IsCurrentValueEmpty())
             summary_format_sp.reset(new StringSummaryFormat(TypeSummaryImpl::Flags(),m_option_variable.summary_string.GetCurrentValue()));
         
-        ValueObject::DumpValueObjectOptions options;
-        
-        options.SetMaximumPointerDepth(m_varobj_options.ptr_depth)
-            .SetMaximumDepth(m_varobj_options.max_depth)
-            .SetShowTypes(m_varobj_options.show_types)
-            .SetShowLocation(m_varobj_options.show_location)
-            .SetUseObjectiveC(m_varobj_options.use_objc)
-            .SetUseDynamicType(m_varobj_options.use_dynamic)
-            .SetUseSyntheticValue(m_varobj_options.use_synth)
-            .SetFlatOutput(m_varobj_options.flat_output)
-            .SetOmitSummaryDepth(m_varobj_options.no_summary_depth)
-            .SetIgnoreCap(m_varobj_options.ignore_cap)
-            .SetSummary(summary_format_sp);
-
-        if (m_varobj_options.be_raw)
-            options.SetRawDisplay(true);
+        ValueObject::DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(false,eFormatDefault,summary_format_sp));
         
         if (variable_list)
         {

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Mar 26 13:04:53 2013
@@ -807,19 +807,8 @@ protected:
 
                     bool scope_already_checked = true;
                     
-                    ValueObject::DumpValueObjectOptions options;
-                    options.SetMaximumPointerDepth(m_varobj_options.ptr_depth)
-                    .SetMaximumDepth(m_varobj_options.max_depth)
-                    .SetShowLocation(m_varobj_options.show_location)
-                    .SetShowTypes(m_varobj_options.show_types)
-                    .SetUseObjectiveC(m_varobj_options.use_objc)
-                    .SetScopeChecked(scope_already_checked)
-                    .SetFlatOutput(m_varobj_options.flat_output)
-                    .SetUseSyntheticValue(m_varobj_options.be_raw ? false : m_varobj_options.use_synth)
-                    .SetOmitSummaryDepth(m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth)
-                    .SetIgnoreCap(m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap)
-                    .SetFormat(format)
-                    .SetSummary();
+                    ValueObject::DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(false,format));
+                    
                     ValueObject::DumpValueObject (*output_stream,
                                                   valobj_sp.get(),
                                                   options);

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Mar 26 13:04:53 2013
@@ -637,19 +637,8 @@ public:
     void
     DumpValueObject (Stream &s, VariableSP &var_sp, ValueObjectSP &valobj_sp, const char *root_name)
     {
-        ValueObject::DumpValueObjectOptions options;
+        ValueObject::DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions());
         
-        options.SetMaximumPointerDepth(m_varobj_options.ptr_depth)
-               .SetMaximumDepth(m_varobj_options.max_depth)
-               .SetShowTypes(m_varobj_options.show_types)
-               .SetShowLocation(m_varobj_options.show_location)
-               .SetUseObjectiveC(m_varobj_options.use_objc)
-               .SetUseDynamicType(m_varobj_options.use_dynamic)
-               .SetUseSyntheticValue(m_varobj_options.use_synth)
-               .SetFlatOutput(m_varobj_options.flat_output)
-               .SetOmitSummaryDepth(m_varobj_options.no_summary_depth)
-               .SetIgnoreCap(m_varobj_options.ignore_cap);
-                
         switch (var_sp->GetScope())
         {
             case eValueTypeVariableGlobal:

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Mar 26 13:04:53 2013
@@ -1989,8 +1989,7 @@ Debugger::FormatPrompt
                                                 ValueObjectSP return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp);
                                                 if (return_valobj_sp)
                                                 {
-                                                    ValueObject::DumpValueObjectOptions dump_options;
-                                                    ValueObject::DumpValueObject (s, return_valobj_sp.get(), dump_options);
+                                                    ValueObject::DumpValueObject (s, return_valobj_sp.get());
                                                     var_success = true;
                                                 }
                                             }

Modified: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=178044&r1=178043&r2=178044&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp Tue Mar 26 13:04:53 2013
@@ -146,3 +146,36 @@ OptionGroupValueObjectDisplay::OptionPar
         use_dynamic = lldb::eNoDynamicValues;
     }
 }
+
+ValueObject::DumpValueObjectOptions
+OptionGroupValueObjectDisplay::GetAsDumpOptions (bool objc_is_compact,
+                                                 lldb::Format format,
+                                                 lldb::TypeSummaryImplSP summary_sp)
+{
+    ValueObject::DumpValueObjectOptions options;
+    options.SetMaximumPointerDepth(ptr_depth);
+    if (use_objc)
+        options.SetShowSummary(false);
+    else
+        options.SetOmitSummaryDepth(no_summary_depth);
+    options.SetMaximumDepth(max_depth)
+    .SetShowTypes(show_types)
+    .SetShowLocation(show_location)
+    .SetUseObjectiveC(use_objc)
+    .SetUseDynamicType(use_dynamic)
+    .SetUseSyntheticValue(use_synth)
+    .SetFlatOutput(flat_output)
+    .SetIgnoreCap(ignore_cap)
+    .SetFormat(format)
+    .SetSummary(summary_sp);
+    
+    if (objc_is_compact)
+        options.SetHideRootType(use_objc)
+        .SetHideName(use_objc)
+        .SetHideValue(use_objc);
+    
+    if (be_raw)
+        options.SetRawDisplay(true);
+
+    return options;
+}





More information about the lldb-commits mailing list