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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96637

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
@@ -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


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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to