https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/69517
Add a way to set a *static* callback to locate DWO files in `SBModule`.
```
SBError SBLocateDwoCallback(void *baton, const SBFileSpec &objfile_spec, const
char *dwo_name, const char *comp_dir, const int64_t dwo_id,
llvmbot wrote:
@llvm/pr-subscribers-lldb
Author: Tom Yang (zhyty)
Changes
Add a way to set a *static* callback to locate DWO files in `SBModule`.
```
SBError SBLocateDwoCallback(void *baton, const SBFileSpec &objfile_spec,
const char *dwo_name, const char *comp_dir, const int64_t dwo_id,
https://github.com/clayborg edited
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
@@ -139,6 +139,13 @@ typedef void (*SBDebuggerDestroyCallback)(lldb::user_id_t
debugger_id,
typedef SBError (*SBPlatformLocateModuleCallback)(
void *baton, const SBModuleSpec &module_spec, SBFileSpec &module_file_spec,
SBFileSpec &symbol_file_spec);
+
+typedef SBError
https://github.com/clayborg requested changes to this pull request.
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
@@ -475,6 +484,8 @@ class SymbolFile : public PluginInterface {
private:
SymbolFile(const SymbolFile &) = delete;
const SymbolFile &operator=(const SymbolFile &) = delete;
+
+ static LocateDwoCallback LOCATE_DWO_CALLBACK;
clayborg wrote:
static variable a
@@ -296,6 +296,20 @@ class LLDB_API SBModule {
/// Remove any global modules which are no longer needed.
static void GarbageCollectAllocatedModules();
+ /// Set a callback which is called to find separate DWARF DWO debug info
+ /// files.
+ ///
+ /// This is useful whe
@@ -1742,20 +1742,37 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
return dwp_sp;
- FileSpec dwo_file(dwo_name);
- FileSystem::Instance().Resolve(dwo_file);
- bool found = false;
+ const char *comp_dir =
+ c
@@ -696,3 +696,55 @@ template <> bool SetNumberFromPyObject(double
&number, PyObject *obj) {
$1 = $input == Py_None;
$1 = $1 || PyCallable_Check(reinterpret_cast($input));
}
+
+// For lldb::SBModuleLocateDwoCallback
+// The `baton` is the actual Python function passed, and
https://github.com/bulbazord edited
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
@@ -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 &ob
@@ -696,3 +696,55 @@ template <> bool SetNumberFromPyObject(double
&number, PyObject *obj) {
$1 = $input == Py_None;
$1 = $1 || PyCallable_Check(reinterpret_cast($input));
}
+
+// For lldb::SBModuleLocateDwoCallback
+// The `baton` is the actual Python function passed, and
@@ -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 &ob
https://github.com/bulbazord commented:
Because SymbolFile is holding onto the function pointer as a static member,
this is a global setting that you can't apply to only just one `SBDebugger`
object. It's an all-or-nothing thing.
Maybe that's what you want, but LLDB already has architectural is
@@ -677,3 +677,30 @@ void SBModule::GarbageCollectAllocatedModules() {
const bool mandatory = false;
ModuleList::RemoveOrphanSharedModules(mandatory);
}
+
+void SBModule::SetLocateDwoCallback(lldb::SBModuleLocateDwoCallback callback,
+voi
@@ -696,3 +696,55 @@ template <> bool SetNumberFromPyObject(double
&number, PyObject *obj) {
$1 = $input == Py_None;
$1 = $1 || PyCallable_Check(reinterpret_cast($input));
}
+
+// For lldb::SBModuleLocateDwoCallback
+// The `baton` is the actual Python function passed, and
@@ -139,6 +139,13 @@ typedef void (*SBDebuggerDestroyCallback)(lldb::user_id_t
debugger_id,
typedef SBError (*SBPlatformLocateModuleCallback)(
void *baton, const SBModuleSpec &module_spec, SBFileSpec &module_file_spec,
SBFileSpec &symbol_file_spec);
+
+typedef SBError
@@ -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 &ob
@@ -1742,20 +1742,37 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
return dwp_sp;
- FileSpec dwo_file(dwo_name);
- FileSystem::Instance().Resolve(dwo_file);
- bool found = false;
+ const char *comp_dir =
+ c
@@ -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 &ob
@@ -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 &ob
@@ -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 &ob
@@ -0,0 +1,119 @@
+"""
+Test module locate dwo callback functionality
+"""
+
+import ctypes
+import shutil
+from lldbsuite.test.decorators import *
+import lldb
+from lldbsuite.test import lldbtest, lldbutil
+
+
+class LocateDwoCallbackTestCase(lldbtest.TestBase):
+NO_DEBUG_IN
@@ -1742,20 +1742,37 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
return dwp_sp;
- FileSpec dwo_file(dwo_name);
- FileSystem::Instance().Resolve(dwo_file);
- bool found = false;
+ const char *comp_dir =
+ c
@@ -0,0 +1,119 @@
+"""
+Test module locate dwo callback functionality
+"""
+
+import ctypes
+import shutil
+from lldbsuite.test.decorators import *
+import lldb
+from lldbsuite.test import lldbtest, lldbutil
+
+
+class LocateDwoCallbackTestCase(lldbtest.TestBase):
+NO_DEBUG_IN
https://github.com/zhyty converted_to_draft
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
26 matches
Mail list logo