aadsm created this revision.
aadsm added reviewers: ADodds, clayborg, eugene.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Once we've attached to the process we load all current modules and also set a 
breakpoint at the rendezvous break address.
However, we don't do this if we already have a load address for the image info 
address (e.g.: DT_DEBUG on ELF). This code was added 4 years ago when adding 
support for `$qXfer:Libraries:` packet (https://reviews.llvm.org/D9471) but its 
intention is not 100% clear to me. It seems to me we're using that check to 
know if the modules have already been loaded (which they have if 
`$qXfer:Libraries:` is supported by the gdb server) and skip loading the 
modules again in the following `if` block. The problem is that we also skip 
setting the Rendezvous breakpoint so we stop knowing when the process loads new 
modules.
I fix this by moving the call to set the breakpoint to the end of the function 
so we always call it as long as we have a valid executable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62168

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
@@ -150,11 +150,6 @@
                          true);
 
     LoadAllCurrentModules();
-    if (!SetRendezvousBreakpoint()) {
-      // If we cannot establish rendezvous breakpoint right now we'll try again
-      // at entry point.
-      ProbeEntry();
-    }
 
     m_process->GetTarget().ModulesDidLoad(module_list);
     if (log) {
@@ -169,6 +164,14 @@
       }
     }
   }
+
+  if (executable_sp.get()) {
+    if (!SetRendezvousBreakpoint()) {
+      // If we cannot establish rendezvous breakpoint right now we'll try again
+      // at entry point.
+      ProbeEntry();
+    }
+  }
 }
 
 void DynamicLoaderPOSIXDYLD::DidLaunch() {


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
@@ -150,11 +150,6 @@
                          true);
 
     LoadAllCurrentModules();
-    if (!SetRendezvousBreakpoint()) {
-      // If we cannot establish rendezvous breakpoint right now we'll try again
-      // at entry point.
-      ProbeEntry();
-    }
 
     m_process->GetTarget().ModulesDidLoad(module_list);
     if (log) {
@@ -169,6 +164,14 @@
       }
     }
   }
+
+  if (executable_sp.get()) {
+    if (!SetRendezvousBreakpoint()) {
+      // If we cannot establish rendezvous breakpoint right now we'll try again
+      // at entry point.
+      ProbeEntry();
+    }
+  }
 }
 
 void DynamicLoaderPOSIXDYLD::DidLaunch() {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to