From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 409503857C44 for ; Wed, 5 Aug 2020 19:08:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 409503857C44 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F3291116AAB; Wed, 5 Aug 2020 15:08:44 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5K2LJUtuSjUs; Wed, 5 Aug 2020 15:08:44 -0400 (EDT) Received: from murgatroyd.Home (75-166-101-103.hlrn.qwest.net [75.166.101.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id AEF40116A6F; Wed, 5 Aug 2020 15:08:44 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 01/12] Call add_active_thread after pushing the ravenscar target Date: Wed, 5 Aug 2020 13:08:30 -0600 Message-Id: <20200805190841.2506771-2-tromey@adacore.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805190841.2506771-1-tromey@adacore.com> References: <20200805190841.2506771-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 19:08:46 -0000 Currently ravenscar-thread.c calls add_active_thread before pushing the ravenscar target. This yields an initial thread announcement of "[Thread 0]". Calling add_active_thread after pushing the target fixes this. 2019-03-26 Tom Tromey * ravenscar-thread.c (ravenscar_thread_target): Don't call add_active_thread. (ravenscar_thread_target::add_active_thread): Now public. (ravenscar_inferior_created): Call add_active_thread after pushing the target. --- gdb/ChangeLog | 8 ++++++++ gdb/ravenscar-thread.c | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 72253188c71..7fca51da2a7 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -79,9 +79,6 @@ struct ravenscar_thread_target final : public target_ops ravenscar_thread_target () : m_base_ptid (inferior_ptid) { - thread_info *thr = add_active_thread (); - if (thr != nullptr) - switch_to_thread (thr); } const target_info &info () const override @@ -124,6 +121,8 @@ struct ravenscar_thread_target final : public target_ops delete this; } + thread_info *add_active_thread (); + private: /* PTID of the last thread that received an event. @@ -131,7 +130,6 @@ struct ravenscar_thread_target final : public target_ops the event, to make it the current task. */ ptid_t m_base_ptid; - thread_info *add_active_thread (); ptid_t active_task (int cpu); bool task_is_currently_active (ptid_t ptid); bool runtime_initialized (); @@ -548,8 +546,11 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty) return; } - target_ops_up target_holder (new ravenscar_thread_target ()); - push_target (std::move (target_holder)); + ravenscar_thread_target *rtarget = new ravenscar_thread_target (); + push_target (target_ops_up (rtarget)); + thread_info *thr = rtarget->add_active_thread (); + if (thr != nullptr) + switch_to_thread (thr); } ptid_t -- 2.26.2