From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id M1NYF5AiCGsrAgAAWB0awg (envelope-from ) for ; Thu, 26 Nov 2026 07:14:08 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DhLZkGuc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4C1861E09B; Thu, 26 Nov 2026 07:14:08 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4667D1E09B for ; Thu, 26 Nov 2026 07:14:07 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCFF242B5DF4 for ; Thu, 26 Nov 2026 12:14:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCFF242B5DF4 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DhLZkGuc Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id CD69242B682C for ; Thu, 26 Nov 2026 12:13:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD69242B682C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CD69242B682C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795695220; cv=none; b=jmH1HGGM8NZXD2dZrEn24PhRSdZeh52KKXMWROmngfqdUmS6P9ygqwWqiV/wj2WCDgNS0yNrpuUYTDYfXI5LYKQCG0RQ0SN+h24OJ88eED6tMBIq+9IK+7CauCcRx9vlRP12OiDyQRL8ehO+z9AKPdzjdq/lhiJvuyNGqJr7x2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795695220; c=relaxed/simple; bh=5z1emJ8i0BMm1SjC49JVb5BhzIbKCOfVWBSyggR3hpY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TZ8xGJYEyqMzMg+yKo+dF0y5Fm2WxYbYu7c06RSVsMziVYoITS4BAkbsxFEZMIWgRRx/IxDhxzX1l0aECD63qu9yhE0hCTCGRAsGNIBCZjwu4BXYGIsCFSQ3lTylzu+nUDXZTTGJqN4ch+NKXWUJa/FtrIpSwinaG3bUbgBud8Q= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DhLZkGuc DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD69242B682C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795695220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cs6sqGmCwujZZjoca4B0q99Gq9sZgbh7aSER/PUx3c0=; b=DhLZkGucarWZQSYv8yiAoLi0BNbWcdsI/XEoWhZP+xcH5DqIeK6SZujstcHgYfaQByIyCr tXKcaVIJt2j561LPMUZsdquaEBjY5VVl4Ucolx0mnLLaR8DFHlpaIV/tb01R/CCh7V4jWK L9YMwO9H8E+4HsD5cG5zxGs0iOMTRRw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-WWsV3aZiNOqyUmZ1ZhfgYw-1; Thu, 26 Nov 2026 12:13:37 +0000 X-MC-Unique: WWsV3aZiNOqyUmZ1ZhfgYw-1 X-Mimecast-MFC-AGG-ID: WWsV3aZiNOqyUmZ1ZhfgYw_1795695217 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 93D861956059 for ; Thu, 26 Nov 2026 12:13:36 +0000 (UTC) Received: from glarsen-thinkpadp16vgen1.rmtbr.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1325C180054C; Thu, 26 Nov 2026 12:13:34 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Kevin Buettner Subject: [PATCH v2] gdb/record: remove PC member from record_full_instruction Date: Thu, 26 Nov 2026 09:12:50 -0300 Message-ID: <20261126121249.30580-2-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TdBYhNXk2tzKGZ5sg7klapX8j0VwbSlmwjqRqTwfzOw_1795695217 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org The recent commit "4d0a9f412df gdb/record: extract the PC to record_full_instruction" caused a regression on s390x, because the recorded register is PSWA, whereas according to gdbarch the PC is a pseudoregister. This was reported as PR record/34937. I tried to make s390 record the gdbarch version, but still got hundreds of regressions in the sigall tests. I then tried to make record ignore the PC member if the length was 0, but that caused problems in the precsave functionality, as we were writing 0 bytes but reading more than 0 as the reading GDB assumed the regnum of 0 was valid. Considering the original motivation for that patch is a micro optimization (a reg_entry is smaller than a generic entry, and the vector is smaller) and improvement for a possible future fix of PR record/18059, it doesn't seem worth it to keep this speculatively. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34937 Approved-By: Kevin Buettner --- Kevin has approved the code changes, but I hadn't added the NEWS file change to v1 so I need Eli's approval before pushing --- gdb/NEWS | 3 +++ gdb/record-full.c | 24 +++--------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 092680aee61..4e94a278945 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -48,6 +48,9 @@ source is modified. Source tracking can be enabled with 'set breakpoint source-tracking enabled on'. +* The record-full precsave format has been changed, and previous + versions will no longer be supported. + * New targets i386 Windows/MSVC i[34567]86-*-windows-msvc diff --git a/gdb/record-full.c b/gdb/record-full.c index 7b1d64069c7..55fc5987a2e 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -79,8 +79,8 @@ ((record_full_next_insn != record_full_log.size ()) \ || ::execution_direction == EXEC_REVERSE) -#define RECORD_FULL_FILE_MAGIC_OLD netorder32(0x20091016) -#define RECORD_FULL_FILE_MAGIC netorder32(0x20260415) +#define RECORD_FULL_FILE_MAGIC_OLD netorder32(0x20260415) +#define RECORD_FULL_FILE_MAGIC netorder32(0x20261126) /* These are the core structs of the process record functionality. @@ -418,7 +418,6 @@ class record_full_entry this one; * sigval: Whether the inferior received a signal while the following instruction was being recorded; - * pc: The Program Counter at the start of the instruction; * effects: A list of record_full_entry structures, each of which describing one effect that the instruction has on the inferior. @@ -433,7 +432,6 @@ struct record_full_instruction uint32_t insn_num; std::optional sigval; std::vector effects; - record_full_reg_entry pc; /* Execute the full instruction. As a side effect, set record_full_stop_reason. */ @@ -755,10 +753,7 @@ record_full_arch_list_add_reg (struct regcache *regcache, int regnum) regcache->cooked_read (regnum, rec.get_loc ()); - if (regnum == gdbarch_pc_regnum (regcache->arch ())) - record_full_incomplete_instruction.pc = std::move (rec.reg ()); - else - record_full_arch_list_add (std::move (rec)); + record_full_arch_list_add (std::move (rec)); return 0; } @@ -914,7 +909,6 @@ static enum target_stop_reason record_full_stop_reason void record_full_instruction::exec_insn (regcache *regcache) { - pc.execute (regcache); for (auto &entry : effects) if (entry.execute (regcache)) record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT; @@ -2413,9 +2407,6 @@ record_full_instruction::from_bfd (bfd *cbfd, asection *osec, int *bfd_offset) if (sigval != GDB_SIGNAL_0) record_full_incomplete_instruction.sigval = (gdb_signal) sigval; - record_full_incomplete_instruction.pc - = record_full_reg_entry::from_bfd (cbfd, osec, bfd_offset); - eff_count = netorder32 (eff_count); /* This deals with all the side effects. */ @@ -2627,8 +2618,6 @@ record_full_instruction::to_bfd (gdb_bfd_ref_ptr &obfd, asection *osec, bfdcore_write (obfd.get (), osec, &insn_num, sizeof (uint32_t), bfd_offset); - this->pc.to_bfd (obfd, osec, bfd_offset); - for (auto &entry : this->effects) { entry.to_bfd (obfd, osec, bfd_offset, gdbarch); @@ -2676,7 +2665,6 @@ record_full_base_target::save_record (const char *recfilename) { /* Number of effects of an instruction. */ save_size += sizeof (uint32_t) + sizeof (uint8_t) + sizeof (uint32_t); - save_size += 4 + record_full_log[i].pc.len; for (auto &entry : record_full_log[i].effects) switch (entry.type ()) { @@ -2830,12 +2818,6 @@ maintenance_print_record_instruction (const char *args, int from_tty) } } } - type *regtype = gdbarch_register_type (arch, to_print->pc.num); - value *val = value_from_contents (regtype, to_print->pc.get_loc ()); - gdb_printf ("Register %s changed: ", - gdbarch_register_name (arch, to_print->pc.num)); - value_print (val, gdb_stdout, opts); - gdb_printf ("\n"); } INIT_GDB_FILE (record_full) base-commit: 1b92b50d1ca485b090c841b8bc755a6ba6f159ee -- 2.56.1