[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Tom Yang via lldb-commits
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,

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread via lldb-commits
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,

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via lldb-commits
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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via lldb-commits
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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-18 Thread Greg Clayton via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -677,3 +677,30 @@ void SBModule::GarbageCollectAllocatedModules() { const bool mandatory = false; ModuleList::RemoveOrphanSharedModules(mandatory); } + +void SBModule::SetLocateDwoCallback(lldb::SBModuleLocateDwoCallback callback, +voi

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via 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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-19 Thread Alex Langford via lldb-commits
@@ -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

[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-20 Thread Tom Yang via lldb-commits
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