summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp20
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp4
-rw-r--r--lldb/source/Interpreter/CommandReturnObject.cpp14
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp6
4 files changed, 37 insertions, 7 deletions
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index b0533e132db..e94c0174819 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -8,8 +8,10 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -329,3 +331,21 @@ SBCommandReturnObject::Printf(const char* format, ...)
return 0;
}
+void
+SBCommandReturnObject::SetError (lldb::SBError &error, const char *fallback_error_cstr)
+{
+ if (m_opaque_ap.get())
+ {
+ if (error.IsValid())
+ m_opaque_ap->SetError(error.ref(), fallback_error_cstr);
+ else if (fallback_error_cstr)
+ m_opaque_ap->SetError(Error(), fallback_error_cstr);
+ }
+}
+
+void
+SBCommandReturnObject::SetError (const char *error_cstr)
+{
+ if (m_opaque_ap.get() && error_cstr)
+ m_opaque_ap->SetError(error_cstr);
+}
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 223083677ec..bbea0851834 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -1330,7 +1330,9 @@ protected:
// Don't change the status if the command already set it...
if (result.GetStatus() == eReturnStatusInvalid)
{
- if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+ if (result.GetErrorData() && result.GetErrorData()[0])
+ result.SetStatus(eReturnStatusFailed);
+ else if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
result.SetStatus(eReturnStatusSuccessFinishNoResult);
else
result.SetStatus(eReturnStatusSuccessFinishResult);
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index 2b93a546f8a..9c63753a23f 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -143,9 +143,19 @@ CommandReturnObject::SetError (const Error &error, const char *fallback_error_cs
const char *error_cstr = error.AsCString();
if (error_cstr == NULL)
error_cstr = fallback_error_cstr;
- AppendError (error_cstr);
- SetStatus (eReturnStatusFailed);
+ SetError(error_cstr);
}
+
+void
+CommandReturnObject::SetError (const char *error_cstr)
+{
+ if (error_cstr)
+ {
+ AppendError (error_cstr);
+ SetStatus (eReturnStatusFailed);
+ }
+}
+
// Similar to AppendError, but do not prepend 'Error: ' to message, and
// don't append "\n" to the end of it.
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index e42ca6807ee..4e41d150842 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -115,7 +115,6 @@ LLDBSwigPythonCallCommand (const char *python_function_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger,
const char* args,
- std::string& err_msg,
lldb_private::CommandReturnObject& cmd_retobj);
extern "C" bool
@@ -2970,7 +2969,7 @@ ScriptInterpreterPython::RunScriptBasedCommand(const char* impl_function,
return false;
}
- bool ret_val;
+ bool ret_val = false;
std::string err_msg;
@@ -2995,12 +2994,11 @@ ScriptInterpreterPython::RunScriptBasedCommand(const char* impl_function,
m_dictionary_name.c_str(),
debugger_sp,
args,
- err_msg,
cmd_retobj);
}
if (!ret_val)
- error.SetErrorString(err_msg.c_str());
+ error.SetErrorString("unable to execute script function");
else
error.Clear();
OpenPOWER on IntegriCloud