summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBCommandReturnObject.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-06-25 23:43:28 +0000
committerEnrico Granata <egranata@apple.com>2013-06-25 23:43:28 +0000
commitb4675a4e12d7120b1b81c41b63b9da55265810a1 (patch)
tree0bdb2f0597a77974186bfe6cee577b0481cee42b /lldb/source/API/SBCommandReturnObject.cpp
parentcc077ad634f14f54f8bb3ac7b6e7c1290f6c701e (diff)
downloadbcm5719-llvm-b4675a4e12d7120b1b81c41b63b9da55265810a1.tar.gz
bcm5719-llvm-b4675a4e12d7120b1b81c41b63b9da55265810a1.zip
<rdar://problem/14266411>
The semi-unofficial way of returning a status from a Python command was to return a string (e.g. return "no such variable was found") that LLDB would pick as a clue of an error having happened This checkin changes that: - SBCommandReturnObject now exports a SetError() call, which can take an SBError or a plain C-string - script commands now drop any return value and expect the SBCommandReturnObject ("return object") to be filled in appropriately - if you do nothing, a success will be assumed If your commands were relying on returning a value and having LLDB pick that up as an error, please change your commands to SetError() through the return object or expect changes in behavior llvm-svn: 184893
Diffstat (limited to 'lldb/source/API/SBCommandReturnObject.cpp')
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp20
1 files changed, 20 insertions, 0 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);
+}
OpenPOWER on IntegriCloud