From patchwork Tue Mar 26 14:43:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31985 Received: (qmail 79429 invoked by alias); 26 Mar 2019 14:44:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 78347 invoked by uid 89); 26 Mar 2019 14:44:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Mar 2019 14:44:08 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E76CD116C6A; Tue, 26 Mar 2019 10:44:06 -0400 (EDT) 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 HSFDxwpTdcAj; Tue, 26 Mar 2019 10:44:06 -0400 (EDT) Received: from murgatroyd.Home (174-29-37-56.hlrn.qwest.net [174.29.37.56]) (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 931F6116C5F; Tue, 26 Mar 2019 10:44:06 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/8] Call update_inferior_ptid after pushing the ravenscar target Date: Tue, 26 Mar 2019 08:43:57 -0600 Message-Id: <20190326144404.6670-2-tromey@adacore.com> In-Reply-To: <20190326144404.6670-1-tromey@adacore.com> References: <20190326144404.6670-1-tromey@adacore.com> MIME-Version: 1.0 Currently ravenscar-thread.c calls update_inferior_ptid before pushing the ravenscar target. This yields an initial thread announcement of "[Thread 0]". Calling update_inferior_ptid after pushing the target fixes this. gdb/ChangeLog 2019-03-26 Tom Tromey * ravenscar-thread.c (ravenscar_thread_target): Don't call update_inferior_ptid. (ravenscar_thread_target::update_inferior_ptid): Now public. (ravenscar_inferior_created): Call update_inferior_ptid after pushing the target. --- gdb/ChangeLog | 8 ++++++++ gdb/ravenscar-thread.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 6636a89554b..225bffcb65a 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -78,7 +78,6 @@ struct ravenscar_thread_target final : public target_ops { ravenscar_thread_target () { - update_inferior_ptid (); } const target_info &info () const override @@ -121,6 +120,8 @@ struct ravenscar_thread_target final : public target_ops delete this; } + void update_inferior_ptid (); + private: /* PTID of the last thread that received an event. @@ -128,7 +129,6 @@ private: the event, to make it the current task. */ ptid_t m_base_ptid = null_ptid; - void update_inferior_ptid (); ptid_t active_task (int cpu); bool task_is_currently_active (ptid_t ptid); bool runtime_initialized (); @@ -543,8 +543,9 @@ 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)); + rtarget->update_inferior_ptid (); } ptid_t