[binutils-gdb] gdbserver: When attaching, add process before lwps

Alan Hayward alahay01@sourceware.org
Mon Jan 28 10:01:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f084d335110408aa08ea06c7cb217ae19697db3d

commit f084d335110408aa08ea06c7cb217ae19697db3d
Author: Alan Hayward <alan.hayward@arm.com>
Date:   Thu Jan 24 18:55:20 2019 +0000

    gdbserver: When attaching, add process before lwps
    
    The recent BP/WP changes for AArch64 swapping the order in add_lwp()
    so that the process was added before the lwp. This was due to the lwp
    creation requiring the process data.
    
    This also needs changing in linux_attach().
    
    Fixes gdb.server/ext-attach.exp on Aarch64.
    
    (This regression was hidden due to the racy nature of the gdb.server
    tests - now they are no longer racy it'll be easier to spot. Also
    checked X86).
    
    gdb/gdbserver/ChangeLog:
    
    2019-01-25  Alan Hayward  <alan.hayward@arm.com>
    
    	* linux-low.c (linux_attach): Add process before lwp.

Diff:
---
 gdb/gdbserver/linux-low.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 44016d2..c6d9417 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1188,6 +1188,8 @@ linux_attach (unsigned long pid)
   ptid_t ptid = ptid_t (pid, pid, 0);
   int err;
 
+  proc = linux_add_process (pid, 1);
+
   /* Attach to PID.  We will check for other threads
      soon.  */
   err = linux_attach_lwp (ptid);
@@ -1198,8 +1200,6 @@ linux_attach (unsigned long pid)
       error ("Cannot attach to process %ld: %s", pid, reason.c_str ());
     }
 
-  proc = linux_add_process (pid, 1);
-
   /* Don't ignore the initial SIGSTOP if we just attached to this
      process.  It will be collected by wait shortly.  */
   initial_thread = find_thread_ptid (ptid_t (pid, pid, 0));



More information about the Gdb-cvs mailing list