[Lldb-commits] [lldb] r177893 - <rdar://problem/13365424>

Enrico Granata egranata at apple.com
Mon Mar 25 12:46:49 PDT 2013


Author: enrico
Date: Mon Mar 25 14:46:48 2013
New Revision: 177893

URL: http://llvm.org/viewvc/llvm-project?rev=177893&view=rev
Log:
<rdar://problem/13365424>

Ensure that option -Y also works for expression as it does for frame variable
Also, if the user passes an explicit format specifier when printing a variable, override the summary's decision to hide the value.

This is required for scenarios like this to work:
(lldb) p/x c
(Class) $0 = 0x0000000100adb7f8 NSObject

Previously this would say:
(lldb) p/x c
(Class) $0 = NSObject

ignoring the explicit format specifier


Modified:
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Core/ValueObject.cpp

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=177893&r1=177892&r2=177893&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Mon Mar 25 14:46:48 2013
@@ -387,22 +387,23 @@ CommandObjectExpression::EvaluateExpress
                         result_valobj_sp->SetFormat (format);
 
                     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)
-                    .SetFormat(format)
-                    .SetSummary()
-                    .SetShowSummary(!m_varobj_options.use_objc)
-                    .SetHideRootType(m_varobj_options.use_objc)
-                    .SetHideName(m_varobj_options.use_objc)
-                    .SetHideValue(m_varobj_options.use_objc);
+                    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);

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=177893&r1=177892&r2=177893&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon Mar 25 14:46:48 2013
@@ -3396,7 +3396,8 @@ DumpValueObject_Impl (Stream &s,
                 // Make sure we have a value and make sure the summary didn't
                 // specify that the value should not be printed - and do not print
                 // the value if this thing is nil
-                if (!is_nil && !value_str.empty() && (entry == NULL || entry->DoesPrintValue() || sum_cstr == NULL) && !options.m_hide_value)
+                // (but show the value if the user passes a format explicitly)
+                if (!is_nil && !value_str.empty() && (entry == NULL || (entry->DoesPrintValue() || options.m_format != eFormatDefault) || sum_cstr == NULL) && !options.m_hide_value)
                     s.Printf(" %s", value_str.c_str());
 
                 if (sum_cstr)





More information about the lldb-commits mailing list