aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linux-nat.c11
2 files changed, 10 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dabc726..c60d20b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-14 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * linux-nat.c (linux_nat_wait_1): Don't use inferior_ptid when
+ checking for initial lwp.
+
2020-09-14 Tom Tromey <tromey@adacore.com>
* m68k-tdep.c (m68k_extract_return_value): Use
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index b810140..4f53670 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -3143,14 +3143,13 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
/* The first time we get here after starting a new inferior, we may
not have added it to the LWP list yet - this is the earliest
moment at which we know its PID. */
- if (inferior_ptid.is_pid ())
+ if (ptid.is_pid () && find_lwp_pid (ptid) == nullptr)
{
- /* Upgrade the main thread's ptid. */
- thread_change_ptid (linux_target, inferior_ptid,
- ptid_t (inferior_ptid.pid (),
- inferior_ptid.pid (), 0));
+ ptid_t lwp_ptid (ptid.pid (), ptid.pid ());
- lp = add_initial_lwp (inferior_ptid);
+ /* Upgrade the main thread's ptid. */
+ thread_change_ptid (linux_target, ptid, lwp_ptid);
+ lp = add_initial_lwp (lwp_ptid);
lp->resumed = 1;
}