Skip to content

[lldb] On POSIX, check for duplicate interpreter modules without loading them #69932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() {
m_initial_modules_added = true;
}
for (; I != E; ++I) {
// Don't load a duplicate copy of ld.so if we have already loaded it
// earlier in LoadInterpreterModule. If we instead loaded then unloaded it
// later, the section information for ld.so would be removed. That
// information is required for placing breakpoints on Arm/Thumb systems.
if ((m_interpreter_module.lock() != nullptr) &&
(I->base_addr == m_interpreter_base))
continue;

ModuleSP module_sp =
LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
if (!module_sp.get())
Expand All @@ -450,15 +458,6 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() {
} else if (module_sp == interpreter_sp) {
// Module already loaded.
continue;
} else {
// If this is a duplicate instance of ld.so, unload it. We may end
// up with it if we load it via a different path than before
// (symlink vs real path).
// TODO: remove this once we either fix library matching or avoid
// loading the interpreter when setting the rendezvous breakpoint.
UnloadSections(module_sp);
loaded_modules.Remove(module_sp);
continue;
}
}

Expand Down