[Lldb-commits] [lldb] r133834 - in /lldb/trunk/source: Commands/CommandObjectExpression.cpp Expression/ClangUserExpression.cpp

Greg Clayton gclayton at apple.com
Fri Jun 24 15:31:10 PDT 2011


Author: gclayton
Date: Fri Jun 24 17:31:10 2011
New Revision: 133834

URL: http://llvm.org/viewvc/llvm-project?rev=133834&view=rev
Log:
Cleanup error output on expressions. 


Modified:
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=133834&r1=133833&r2=133834&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jun 24 17:31:10 2011
@@ -335,7 +335,22 @@
             }
             else
             {
-                error_stream->PutCString(result_valobj_sp->GetError().AsCString());
+                const char *error_cstr = result_valobj_sp->GetError().AsCString();
+                if (error_cstr && error_cstr[0])
+                {
+                    int error_cstr_len = strlen (error_cstr);
+                    const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n';
+                    if (strstr(error_cstr, "error:") != error_cstr)
+                        error_stream->PutCString ("error: ");
+                    error_stream->Write(error_cstr, error_cstr_len);
+                    if (!ends_with_newline)
+                        error_stream->EOL();
+                }
+                else
+                {
+                    error_stream->PutCString ("error: unknown error\n");
+                }
+
                 if (result)
                     result->SetStatus (eReturnStatusFailed);
             }

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=133834&r1=133833&r2=133834&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Jun 24 17:31:10 2011
@@ -599,7 +599,7 @@
     
     if (exe_ctx.process == NULL || exe_ctx.process->GetState() != lldb::eStateStopped)
     {
-        error.SetErrorString ("Must have a live but stopped process to evaluate expressions.");
+        error.SetErrorString ("must have a stopped process to evaluate expressions.");
             
         result_valobj_sp = ValueObjectConstResult::Create (NULL, error);
         return eExecutionSetupError;





More information about the lldb-commits mailing list