Module Name: src
Committed By: christos
Date: Sun Jul 14 18:50:58 UTC 2019
Modified Files:
src/external/gpl3/gdb/dist/gdb: nbsd-nat.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gdb/dist/gdb/nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.12 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.13
--- src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.12 Thu Jun 13 21:00:52 2019
+++ src/external/gpl3/gdb/dist/gdb/nbsd-nat.c Sun Jul 14 14:50:58 2019
@@ -263,7 +263,12 @@ nbsd_add_threads (pid_t pid)
{
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 @@ nbsd_nat_target::wait (ptid_t ptid, stru
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);