[Lldb-commits] [PATCH] D96637: Make sure the interpreter module was loaded before making checks against it

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 12 14:37:52 PST 2021

aadsm created this revision.
aadsm added reviewers: mgorny, labath, emaste.
aadsm requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This issue was introduced in https://reviews.llvm.org/D92187.
The guard I'm changing were is supposed to act when linux is loading the linker for the second time (due to differences in paths like symlinks).
This is done by checking `module_sp != m_interpreter_module.lock()` however this will be true when `m_interpreter_module` wasn't initialized, making linux unload the linker module (the most visible result here is that lldb will stop getting notified about new modules loaded by the process, because it can't set the rendezvous breakpoint again after the stepping over it once).
The `m_interpreter_module` is not getting initialize when it goes through this path: https://github.com/llvm/llvm-project/blob/dbfdb139f75470a9abc78e7c9faf743fdd963c2d/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp#L332, which happens when lldb was able to read the address from the dynamic section of the executable.

What I'm not sure about though, is if when we go through this path if we still load the linker twice on linux. If that's the case then it means we need to somehow set the m_interpreter_module instead of the fix I provide here. I've only tested this on Android.

  rG LLVM Github Monorepo



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
@@ -441,6 +441,7 @@
       if (module_sp.get()) {
         if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
                 &m_process->GetTarget()) == m_interpreter_base &&
+            m_interpreter_module.lock() &&
             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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96637.323485.patch
Type: text/x-patch
Size: 751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210212/698db93e/attachment.bin>

More information about the lldb-commits mailing list