summaryrefslogtreecommitdiff
path: root/lldb/bindings
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2023-05-02 13:41:07 -0700
committerJim Ingham <jingham@apple.com>2023-05-03 10:52:12 -0700
commitc2be702104284cb3facf31124494b9a400296179 (patch)
tree9601dfe2ef698bb9baf177a4078eba79b597f33e /lldb/bindings
parentcd05ffdbb2c303cbf476a3a48b3f67094d428e37 (diff)
downloadllvm-c2be702104284cb3facf31124494b9a400296179.tar.gz
Allow scripted thread plans to modify the thread stop description when
they are completed.
Diffstat (limited to 'lldb/bindings')
-rw-r--r--lldb/bindings/python/python-wrapper.swig32
1 files changed, 32 insertions, 0 deletions
diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig
index d339f592cec4..bb452658a838 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -367,6 +367,38 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(
return false;
}
+bool lldb_private::LLDBSWIGPythonCallThreadPlan(
+ void *implementor, const char *method_name, lldb_private::Stream *stream,
+ bool &got_error) {
+ got_error = false;
+
+ PyErr_Cleaner py_err_cleaner(false);
+ PythonObject self(PyRefType::Borrowed, static_cast<PyObject *>(implementor));
+ auto pfunc = self.ResolveName<PythonCallable>(method_name);
+
+ if (!pfunc.IsAllocated())
+ return false;
+
+ auto *sb_stream = new lldb::SBStream();
+ PythonObject sb_stream_arg =
+ ToSWIGWrapper(std::unique_ptr<lldb::SBStream>(sb_stream));
+
+ PythonObject result;
+ result = pfunc(sb_stream_arg);
+
+ if (PyErr_Occurred()) {
+ printf("Error occured for call to %s.\n",
+ method_name);
+ PyErr_Print();
+ got_error = true;
+ return false;
+ }
+ if (stream)
+ stream->PutCString(sb_stream->GetData());
+ return true;
+
+}
+
PythonObject lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args_impl,