From patchwork Thu Oct 17 22:50:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 35104 Received: (qmail 105654 invoked by alias); 17 Oct 2019 22:50:33 -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 105623 invoked by uid 89); 17 Oct 2019 22:50:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Oct 2019 22:50:32 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE2A118C4276 for ; Thu, 17 Oct 2019 22:50:30 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 789291001DD7 for ; Thu, 17 Oct 2019 22:50:30 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 02/24] Don't rely on inferior_ptid in record_full_wait Date: Thu, 17 Oct 2019 23:50:04 +0100 Message-Id: <20191017225026.30496-3-palves@redhat.com> In-Reply-To: <20191017225026.30496-1-palves@redhat.com> References: <20191017225026.30496-1-palves@redhat.com> The multi-target patch sets inferior_ptid to null_ptid before handling a target event, and thus before calling target_wait, in order to catch places in target_ops::wait implementations that are incorrectly relying on inferior_ptid (which could otherwise be a ptid of a different target, for example). That caught this instance in record-full.c. Fix it by saving the last resumed ptid, and then using it in record_full_wait_1, just like how the last "step" argument passed to record_full_target::resume is handled too. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * record-full.c (record_full_resume_ptid): New global. (record_full_target::resume): Set it. (record_full_wait_1): Use record_full_resume_ptid instead of inferior_ptid. --- gdb/record-full.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index 0c6cb62163..5168b0b61c 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1036,6 +1036,9 @@ record_full_base_target::async (int enable) beneath ()->async (enable); } +/* The PTID and STEP arguments last passed to + record_full_target::resume. */ +static ptid_t record_full_resume_ptid = null_ptid; static int record_full_resume_step = 0; /* True if we've been resumed, and so each record_full_wait call should @@ -1064,6 +1067,7 @@ static enum exec_direction_kind record_full_execution_dir = EXEC_FORWARD; void record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal) { + record_full_resume_ptid = inferior_ptid; record_full_resume_step = step; record_full_resumed = 1; record_full_execution_dir = ::execution_direction; @@ -1190,7 +1194,8 @@ record_full_wait_1 (struct target_ops *ops, /* This is not a single step. */ ptid_t ret; CORE_ADDR tmp_pc; - struct gdbarch *gdbarch = target_thread_architecture (inferior_ptid); + struct gdbarch *gdbarch + = target_thread_architecture (record_full_resume_ptid); while (1) {