[Lldb-commits] [PATCH] D109797: Fix rendezvous for rebase_exec=true case
Emre Kultursay via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 14 17:06:01 PDT 2021
emrekultursay created this revision.
emrekultursay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
When rebase_exec=true in DidAttach(), all modules are loaded
before the rendezvous breakpoint is set, which means the
LoadInterpreterModule() method is not called and m_interpreter_module
is not initialized.
This causes the very first rendezvous breakpoint hit (with
m_initial_modules_added=false) to accidentally unload the
module_sp that corresponds to the dynamic loader.
This bug was causing the rendezvous mechanism to not work
in Android 28, which this CL fixes.
Test: Verified rendezvous on Android 28 and 29
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109797
Files:
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
Index: lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -442,14 +442,18 @@
if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
&m_process->GetTarget()) == m_interpreter_base &&
module_sp != m_interpreter_module.lock()) {
- // 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;
+ if (m_interpreter_module.lock() == nullptr) {
+ m_interpreter_module = module_sp;
+ } 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;
+ }
}
loaded_modules.AppendIfNeeded(module_sp);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109797.372592.patch
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210915/2f768015/attachment.bin>
More information about the lldb-commits
mailing list