Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb PR/54375: Andreas Gustafsson: gdb...



details:   https://anonhg.NetBSD.org/src/rev/e9a319509b61
branches:  trunk
changeset: 1000216:e9a319509b61
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jul 14 18:50:58 2019 +0000

description:
PR/54375: Andreas Gustafsson: gdb attached to running process shows extra
thread. When attaching to a process that has threads make sure that we
mutate the inferior_ptid (that currently has lwpid == 0 to the first thread
we encounter.

diffstat:

 external/gpl3/gdb/dist/gdb/nbsd-nat.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r aff32509ccc1 -r e9a319509b61 external/gpl3/gdb/dist/gdb/nbsd-nat.c
--- a/external/gpl3/gdb/dist/gdb/nbsd-nat.c     Sun Jul 14 16:12:02 2019 +0000
+++ b/external/gpl3/gdb/dist/gdb/nbsd-nat.c     Sun Jul 14 18:50:58 2019 +0000
@@ -263,7 +263,12 @@
     {
       ptid_t ptid = ptid_t (pid, pl.pl_lwpid, 0);
       if (!in_thread_list (ptid))
-       add_thread (ptid);
+       {
+         if (inferior_ptid.lwp () == 0)
+           thread_change_ptid (inferior_ptid, ptid);
+         else
+           add_thread (ptid);
+       }
     }
 }
 
@@ -454,7 +459,10 @@
               ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
               return wptid;
             }
-            add_thread (wptid);
+           if (inferior_ptid.lwp () == 0)
+             thread_change_ptid (inferior_ptid, wptid);
+           else
+             add_thread (wptid);
             ourstatus->kind = TARGET_WAITKIND_THREAD_CREATED;
             if (debug_nbsd_lwp)
               fprintf_unfiltered (gdb_stdlog, "NLWP: created LWP %d\n", pst.pe_lwp);



Home | Main Index | Thread Index | Old Index