================
@@ -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));
+  if (!callable.IsValid()) {
+    return SBError("The callback callable is not valid.");
----------------
bulbazord wrote:

This error doesn't make a lot of sense for somebody trying to use this 
functionality. Maybe something like "Argument 'baton' is not a valid Python 
callback"?

https://github.com/llvm/llvm-project/pull/69517
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to