[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 19 09:42:33 PDT 2023
================
@@ -1168,4 +1168,58 @@ static SBError LLDBSwigPythonCallLocateModuleCallback(
return *sb_error_ptr;
}
+
+// `comp_dir` is allowed to be NULL. All other arguments must be valid values.
+static SBError LLDBSwigPythonCallLocateDwoCallback(
+ void *baton, const SBFileSpec &objfile_spec_sb,
+ const char *dwo_name, const char *comp_dir, const int64_t dwo_id, SBFileSpec &located_dwo_file_spec_sb) {
+ SWIG_Python_Thread_Block swig_thread_block;
+
+ PyErr_Cleaner py_err_cleaner(true);
+ if (dwo_name == NULL) {
+ return SBError("`dwo_name` is NULL. Expected a valid string.");
+ }
+ PythonString dwo_name_arg(dwo_name);
+ PythonObject comp_dir_arg(PyRefType::Borrowed, Py_None);
+ if (comp_dir != NULL) {
+ comp_dir_arg = PythonString(comp_dir);
+ }
+ PythonObject dwo_id_arg = PythonInteger(dwo_id);
+ PythonObject objfile_spec_arg = SWIGBridge::ToSWIGWrapper(
+ std::make_unique<SBFileSpec>(objfile_spec_sb));
+ PythonObject located_dwo_file_spec_arg = SWIGBridge::ToSWIGWrapper(
+ std::make_unique<SBFileSpec>(located_dwo_file_spec_sb));
+
+ PythonCallable callable =
+ Retain<PythonCallable>(reinterpret_cast<PyObject *>(baton));
----------------
bulbazord wrote:
You need to check for `NULL` before calling `Retain` because it will assert if it's passed `NULL`.
https://github.com/llvm/llvm-project/pull/69517
More information about the lldb-commits
mailing list