diff options
author | Greg Clayton <gclayton@apple.com> | 2011-06-24 22:31:10 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-06-24 22:31:10 +0000 |
commit | 5fd05903d488cc91dc53c40bc0c7e802b4998ce8 (patch) | |
tree | ee94545b8213e4cbfeefac5408e0b35fceb85a45 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | 6bc2164d2af69f62291a54e143208c883911739d (diff) | |
download | bcm5719-llvm-5fd05903d488cc91dc53c40bc0c7e802b4998ce8.tar.gz bcm5719-llvm-5fd05903d488cc91dc53c40bc0c7e802b4998ce8.zip |
Cleanup error output on expressions.
llvm-svn: 133834
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 7d1af333d84..57dd7c70bb3 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -335,7 +335,22 @@ CommandObjectExpression::EvaluateExpression } 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); } |