From patchwork Tue Nov 21 22:29:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 24436 Received: (qmail 39383 invoked by alias); 21 Nov 2017 22:29:35 -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 39338 invoked by uid 89); 21 Nov 2017 22:29:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=3106, our 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, 21 Nov 2017 22:29:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A31D5116505; Tue, 21 Nov 2017 17:29:32 -0500 (EST) 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 0UpmFiOFR1Qg; Tue, 21 Nov 2017 17:29:32 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 732751163C6; Tue, 21 Nov 2017 17:29:32 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id BB9A58745A; Tue, 21 Nov 2017 14:29:30 -0800 (PST) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Xavier Roirand , Jerome Guitton Subject: [Ada 6/6] ravenscar: update inferior ptid with event ptid Date: Tue, 21 Nov 2017 14:29:23 -0800 Message-Id: <20171121222923.8951-7-brobecker@adacore.com> In-Reply-To: <20171121222923.8951-1-brobecker@adacore.com> References: <20171121222923.8951-1-brobecker@adacore.com> From: Jerome Guitton When debugging a program using a ravenscar runtime, the thread layer sometimes gets confused, and even missing some threads. This was traced to an assumption that ravenscar_wait was making, which is that calling the "to_wait" target_ops method would set the inferior_ptid, so that we could then use that assumption to update our thread_list and current ptid. However, this has not been the case for quite a while now. This patch fixes the problem by assigning inferior_ptid the ptid returned by "to_wait". gdb/ChangeLog: * ravenscar-thread.c (ravenscar_wait): Update inferior ptid with event ptid from the lower layer before doing the ravenscar-specific update. --- gdb/ravenscar-thread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 00593b84db..30745f7caa 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -297,9 +297,10 @@ ravenscar_wait (struct target_ops *ops, ptid_t ptid, int options) { struct target_ops *beneath = find_target_beneath (ops); + ptid_t event_ptid; inferior_ptid = base_ptid; - beneath->to_wait (beneath, base_ptid, status, 0); + event_ptid = beneath->to_wait (beneath, base_ptid, status, 0); /* Find any new threads that might have been created, and update inferior_ptid to the active thread. @@ -310,6 +311,7 @@ ravenscar_wait (struct target_ops *ops, ptid_t ptid, if (status->kind != TARGET_WAITKIND_EXITED && status->kind != TARGET_WAITKIND_SIGNALLED) { + inferior_ptid = event_ptid; ravenscar_update_thread_list (ops); ravenscar_update_inferior_ptid (); }