From 29c87f7ff2089f6ef9a07852e4ed382df5223007 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 5 Nov 2008 21:19:45 +0000 Subject: [PATCH] * remote.c (notice_new_inferiors): Add a new inferior only when we're going to add a new thread. --- gdb/ChangeLog | 5 +++++ gdb/remote.c | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5e0413052e0..48b0a6fe596 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-11-05 Pedro Alves + + * remote.c (notice_new_inferiors): Add a new inferior only when + we're going to add a new thread. + 2008-11-05 Pedro Alves * defs.h (add_inferior_continuation) diff --git a/gdb/remote.c b/gdb/remote.c index f4d6c1f48cd..b36a4b46946 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1127,13 +1127,6 @@ static ptid_t continue_thread; static void notice_new_inferiors (ptid_t currthread) { - /* When connecting to a target remote, or to a target - extended-remote which already was debugging an inferior, we may - not know about it yet. Add it before adding its child thread, so - notifications are emitted in a sensible order. */ - if (!in_inferior_list (ptid_get_pid (currthread))) - add_inferior (ptid_get_pid (currthread)); - /* If this is a new thread, add it to GDB's thread list. If we leave it up to WFI to do this, bad things will happen. */ @@ -1169,6 +1162,13 @@ notice_new_inferiors (ptid_t currthread) return; } + /* When connecting to a target remote, or to a target + extended-remote which already was debugging an inferior, we + may not know about it yet. Add it before adding its child + thread, so notifications are emitted in a sensible order. */ + if (!in_inferior_list (ptid_get_pid (currthread))) + add_inferior (ptid_get_pid (currthread)); + /* This is really a new thread. Add it. */ add_thread (currthread); } -- 2.30.2