[PATCH v4 13/44] gdbserver: move dlls_changed initialization on attach into targets

Markus Metzger <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
This prepares for a new target that may not select a thread or process
during attach and the initial wait.
---
 gdbserver/linux-low.cc | 5 +++++
 gdbserver/server.cc    | 6 ------
 gdbserver/win32-low.cc | 7 +++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index f1be62225e2..f14e5b1dc32 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -1213,6 +1213,11 @@ linux_process_target::attach (unsigned long pid)
       error (_("Cannot attach to process %ld: %s"), pid, reason.c_str ());
     }
 
+  /* Don't report shared library events after attaching, even if some
+     libraries are preloaded.  GDB will always poll the library list.
+     Avoids the "stopped by shared library event" notice on the GDB
+     side.  */
+  proc->dlls_changed = false;
   open_proc_mem_file (proc);
 
   /* Don't ignore the initial SIGSTOP if we just attached to this
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 4a727c465f0..471d6782091 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -3365,12 +3365,6 @@ handle_v_attach (char *own_buf)
     {
       if (attach_inferior (pid) == 0)
 	{
-	  /* Don't report shared library events after attaching, even if
-	     some libraries are preloaded.  GDB will always poll the
-	     library list.  Avoids the "stopped by shared library event"
-	     notice on the GDB side.  */
-	  current_process ()->dlls_changed = false;
-
 	  if (non_stop)
 	    {
 	      /* In non-stop, we don't send a resume reply.  Stop events
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 7629beca213..935ac6657f7 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -373,6 +373,13 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
     = inferior_started_by_cygwin (pid, attached);
 #endif
 
+  /* Don't report shared library events after attaching, even if some
+     libraries are preloaded.  GDB will always poll the library list.
+     Avoids the "stopped by shared library event" notice on the GDB
+     side.  */
+  if (attached)
+    proc->dlls_changed = false;
+
   windows_process.child_initialization_done = 1;
 }
 
-- 
2.43.0

________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.