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

Sean Callanan scallanan at apple.com
Thu Aug 9 11:18:47 PDT 2012


Author: spyffe
Date: Thu Aug  9 13:18:47 2012
New Revision: 161600

URL: http://llvm.org/viewvc/llvm-project?rev=161600&view=rev
Log:
LLDB no longer prints <no result> by default if
the expression returns nothing.  There is now a
setting, "notify-void."  When the user enables
that setting, lldb prints (void) if an expression's
result is void.  Otherwise, lldb is silent.

<rdar://problem/11225150>

Modified:
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=161600&r1=161599&r2=161600&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Thu Aug  9 13:18:47 2012
@@ -146,6 +146,12 @@
             m_prompt.assign ("(lldb) ");
         BroadcastPromptChange (m_instance_name, m_prompt.c_str());
     }
+    
+    bool
+    GetNotifyVoid() const
+    {
+        return m_notify_void;
+    }
 
     const char *
     GetFrameFormat() const
@@ -247,6 +253,7 @@
     uint32_t m_stop_disassembly_count;
     StopDisassemblyType m_stop_disassembly_display;
     std::string m_prompt;
+    bool m_notify_void;
     std::string m_frame_format;
     std::string m_thread_format;
     lldb::ScriptLanguage m_script_lang;

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=161600&r1=161599&r2=161600&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Aug  9 13:18:47 2012
@@ -374,13 +374,13 @@
             {
                 if (result_valobj_sp->GetError().GetError() == ClangUserExpression::kNoResult)
                 {
-                    if (format != eFormatVoid)
+                    if (format != eFormatVoid && m_interpreter.GetDebugger().GetNotifyVoid())
                     {
-                        error_stream->PutCString("<no result>\n");
-                        
-                        if (result)
-                            result->SetStatus (eReturnStatusSuccessFinishResult);
+                        error_stream->PutCString("(void)\n");
                     }
+                    
+                    if (result)
+                        result->SetStatus (eReturnStatusSuccessFinishResult);
                 }
                 else
                 {

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=161600&r1=161599&r2=161600&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Aug  9 13:18:47 2012
@@ -73,6 +73,13 @@
 }
 
 static const ConstString &
+GetNotifyVoidName ()
+{
+    static ConstString g_const_string ("notify-void");
+    return g_const_string;
+}
+
+static const ConstString &
 GetFrameFormatName ()
 {
     static ConstString g_const_string ("frame-format");
@@ -2425,6 +2432,7 @@
     m_stop_disassembly_count (4),
     m_stop_disassembly_display (eStopDisassemblyTypeNoSource),
     m_prompt (),
+    m_notify_void (false),
     m_frame_format (),
     m_thread_format (),    
     m_script_lang (),
@@ -2452,6 +2460,7 @@
 DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs) :
     InstanceSettings (Debugger::GetSettingsController(), CreateInstanceName ().AsCString()),
     m_prompt (rhs.m_prompt),
+    m_notify_void (rhs.m_notify_void),
     m_frame_format (rhs.m_frame_format),
     m_thread_format (rhs.m_thread_format),
     m_script_lang (rhs.m_script_lang),
@@ -2477,6 +2486,7 @@
     {
         m_term_width = rhs.m_term_width;
         m_prompt = rhs.m_prompt;
+        m_notify_void = rhs.m_notify_void;
         m_frame_format = rhs.m_frame_format;
         m_thread_format = rhs.m_thread_format;
         m_script_lang = rhs.m_script_lang;
@@ -2560,6 +2570,10 @@
             BroadcastPromptChange (new_name, m_prompt.c_str());
         }
     }
+    else if (var_name == GetNotifyVoidName())
+    {
+        UserSettingsController::UpdateBooleanVariable (op, m_notify_void, value, false, err);
+    }
     else if (var_name == GetFrameFormatName())
     {
         UserSettingsController::UpdateStringVariable (op, m_frame_format, value, err);
@@ -2624,7 +2638,10 @@
     if (var_name == PromptVarName())
     {
         value.AppendString (m_prompt.c_str(), m_prompt.size());
-        
+    }
+    else if (var_name == GetNotifyVoidName())
+    {
+        value.AppendString (m_notify_void ? "true" : "false");
     }
     else if (var_name == ScriptLangVarName())
     {
@@ -2715,6 +2732,7 @@
 
         BroadcastPromptChange (new_name, m_prompt.c_str());
     }
+    m_notify_void = new_debugger_settings->m_notify_void;
     m_frame_format = new_debugger_settings->m_frame_format;
     m_thread_format = new_debugger_settings->m_thread_format;
     m_term_width = new_debugger_settings->m_term_width;
@@ -2821,6 +2839,7 @@
 //  ======================= ======================= ======================  ====  ====== ====== ======================
 {   "frame-format",         eSetVarTypeString,      DEFAULT_FRAME_FORMAT,   NULL, false, false, "The default frame format string to use when displaying thread information." },
 {   "prompt",               eSetVarTypeString,      "(lldb) ",              NULL, false, false, "The debugger command line prompt displayed for the user." },
+{   "notify-void",          eSetVarTypeBoolean,     "false",                NULL, false, false, "Notify the user explicitly if an expression returns void." },
 {   "script-lang",          eSetVarTypeString,      "python",               NULL, false, false, "The script language to be used for evaluating user-written scripts." },
 {   "term-width",           eSetVarTypeInt,         "80"    ,               NULL, false, false, "The maximum number of columns to use for displaying text." },
 {   "thread-format",        eSetVarTypeString,      DEFAULT_THREAD_FORMAT,  NULL, false, false, "The default thread format string to use when displaying thread information." },





More information about the lldb-commits mailing list