[lldb] Enable locate module callback for all module loading (#160199)

Main executables were bypassing the locate module callback that shared 
libraries use, preventing custom symbol file location logic from working
consistently. 

This PR fix this by
*   Adding target context to ModuleSpec
* Leveraging that context to use target search path and platform's
locate module callback in ModuleList::GetSharedModule

This ensures both main executables and shared libraries get the same 
callback treatment for symbol file resolution.

---------

Co-authored-by: George Hu <hyubo@meta.com>
Co-authored-by: George Hu <georgehuyubo@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-11-06 12:48:21 -08:00
1 parent c12cb2892c
commit fce58897ce
36 files changed
+383 -178

No files matched your search

+2 -2
View File
@@ -37,8 +37,8 @@ SBModule::SBModule(const SBModuleSpec &module_spec) {
LLDB_INSTRUMENT_VA(this, module_spec);
ModuleSP module_sp;
Status error = ModuleList::GetSharedModule(
*module_spec.m_opaque_up, module_sp, nullptr, nullptr, nullptr);
Status error = ModuleList::GetSharedModule(*module_spec.m_opaque_up,
module_sp, nullptr, nullptr);
if (module_sp)
SetSP(module_sp);
}