[Lldb-commits] [lldb] r161502 - in /lldb/trunk: include/lldb/lldb-enumerations.h source/Commands/CommandObjectExpression.cpp source/Commands/CommandObjectMemory.cpp source/Core/FormatManager.cpp source/Target/Process.cpp

Sean Callanan scallanan at apple.com
Wed Aug 8 10:35:11 PDT 2012


Author: spyffe
Date: Wed Aug  8 12:35:10 2012
New Revision: 161502

URL: http://llvm.org/viewvc/llvm-project?rev=161502&view=rev
Log:
Added a 'void' format so that the user can manually
suppress all non-error output from the "expression"
command.

<rdar://problem/11225150>

Modified:
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Core/FormatManager.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=161502&r1=161501&r2=161502&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Aug  8 12:35:10 2012
@@ -124,6 +124,7 @@
         eFormatAddressInfo,         // Describe what an address points to (func + offset with file/line, symbol + offset, data, etc)
         eFormatHexFloat,            // ISO C99 hex float string
         eFormatInstruction,         // Disassemble an opcode
+        eFormatVoid,                // Do not print this
         kNumFormats
     } Format;
 

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=161502&r1=161501&r2=161502&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Wed Aug  8 12:35:10 2012
@@ -335,44 +335,51 @@
                 }
             }
         }
-
+        
         if (result_valobj_sp)
         {
+            Format format = m_format_options.GetFormat();
+
             if (result_valobj_sp->GetError().Success())
             {
-                Format format = m_format_options.GetFormat();
-                if (format != eFormatDefault)
-                    result_valobj_sp->SetFormat (format);
-
-                ValueObject::DumpValueObjectOptions options;
-                options.SetMaximumPointerDepth(0)
-                .SetMaximumDepth(UINT32_MAX)
-                .SetShowLocation(false)
-                .SetShowTypes(m_command_options.show_types)
-                .SetUseObjectiveC(m_command_options.print_object)
-                .SetUseDynamicType(use_dynamic)
-                .SetScopeChecked(true)
-                .SetFlatOutput(false)
-                .SetUseSyntheticValue(true)
-                .SetIgnoreCap(false)
-                .SetFormat(format)
-                .SetSummary()
-                .SetShowSummary(!m_command_options.print_object);
-                
-                ValueObject::DumpValueObject (*(output_stream),
-                                              result_valobj_sp.get(),   // Variable object to dump
-                                              options);
-                if (result)
-                    result->SetStatus (eReturnStatusSuccessFinishResult);
+                if (format != eFormatVoid)
+                {
+                    if (format != eFormatDefault)
+                        result_valobj_sp->SetFormat (format);
+
+                    ValueObject::DumpValueObjectOptions options;
+                    options.SetMaximumPointerDepth(0)
+                    .SetMaximumDepth(UINT32_MAX)
+                    .SetShowLocation(false)
+                    .SetShowTypes(m_command_options.show_types)
+                    .SetUseObjectiveC(m_command_options.print_object)
+                    .SetUseDynamicType(use_dynamic)
+                    .SetScopeChecked(true)
+                    .SetFlatOutput(false)
+                    .SetUseSyntheticValue(true)
+                    .SetIgnoreCap(false)
+                    .SetFormat(format)
+                    .SetSummary()
+                    .SetShowSummary(!m_command_options.print_object);
+                    
+                    ValueObject::DumpValueObject (*(output_stream),
+                                                  result_valobj_sp.get(),   // Variable object to dump
+                                                  options);
+                    if (result)
+                        result->SetStatus (eReturnStatusSuccessFinishResult);
+                }
             }
             else
             {
                 if (result_valobj_sp->GetError().GetError() == ClangUserExpression::kNoResult)
                 {
-                    error_stream->PutCString("<no result>\n");
-                    
-                    if (result)
-                        result->SetStatus (eReturnStatusSuccessFinishResult);
+                    if (format != eFormatVoid)
+                    {
+                        error_stream->PutCString("<no result>\n");
+                        
+                        if (result)
+                            result->SetStatus (eReturnStatusSuccessFinishResult);
+                    }
                 }
                 else
                 {

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=161502&r1=161501&r2=161502&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Aug  8 12:35:10 2012
@@ -1108,6 +1108,7 @@
             case eFormatAddressInfo:
             case eFormatHexFloat:
             case eFormatInstruction:
+            case eFormatVoid:
                 result.AppendError("unsupported format for writing memory");
                 result.SetStatus(eReturnStatusFailed);
                 return false;

Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=161502&r1=161501&r2=161502&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Wed Aug  8 12:35:10 2012
@@ -65,7 +65,8 @@
     { eFormatCharArray      , 'a'   , "character array"     },
     { eFormatAddressInfo    , 'A'   , "address"             },
     { eFormatHexFloat       , 'X'   , "hex float"           },
-    { eFormatInstruction    , 'i'   , "instruction"         }
+    { eFormatInstruction    , 'i'   , "instruction"         },
+    { eFormatVoid           , 'v'   , "void"                }
 };
 
 static uint32_t 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=161502&r1=161501&r2=161502&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Aug  8 12:35:10 2012
@@ -4319,7 +4319,7 @@
                             if (stop_state == eStateExited)
                                 event_to_broadcast_sp = event_sp;
                                 
-                            errors.Printf ("Execution stopped with unexpected state.");
+                            errors.Printf ("Execution stopped with unexpected state.\n");
                             return_value = eExecutionInterrupted;
                             break;
                         }





More information about the lldb-commits mailing list