From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>,
Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Eli Zaretskii <eliz@gnu.org>
Subject: [PATCH v3 6/7] gdb/record: Define new version of the record-save section
Date: Fri, 15 May 2026 13:37:04 -0300 [thread overview]
Message-ID: <20260515163706.3355686-8-guinevere@redhat.com> (raw)
In-Reply-To: <20260515163706.3355686-1-guinevere@redhat.com>
With the changes to the internal representation of the history, we can
no longer support the previous record save format. This commit makes it
official, documenting the new format and changing the magic number.
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
---
gdb/NEWS | 4 ++++
gdb/record-full.c | 35 +++++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 48a80856aa1..c06e83bb1ba 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -51,6 +51,10 @@
* Support for the binary file format dbx has been removed.
+* The format for a saved execution record, created when the command
+ 'record save' is used, has been updated, and previous formats are
+ no longer supported.
+
* When connected to an extended-remote target GDB can now
automatically set the 'remote exec-file' in some cases. GDB will
auto set the remote exec-file only if the remote wasn't started with
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 17696e07c0d..055d2c66346 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -79,7 +79,8 @@
((record_full_next_insn != record_full_list.size ()) \
|| ::execution_direction == EXEC_REVERSE)
-#define RECORD_FULL_FILE_MAGIC netorder32(0x20091016)
+#define RECORD_FULL_FILE_MAGIC_OLD netorder32(0x20091016)
+#define RECORD_FULL_FILE_MAGIC netorder32(0x20260415)
/* These are the core structs of the process record functionality.
@@ -2205,6 +2206,27 @@ record_full_core_target::has_execution (inferior *inf)
8 bytes: memory address (network byte order).
n bytes: memory value (n == memory length).
+ Version 3 (all numbers are in network order).
+ 4 bytes: Magic number (0x20260415).
+ NOTE: be sure to change whenever this file format changes!
+
+ Records:
+ record_full_instruction:
+ 1 byte: signal.
+ 4 bytes: number of reg and mem entries for this instruction.
+ 4 bytes: instruction sequence number.
+ 4 bytes: PC register ID.
+ N bytes: PC address of instruction (N == size of PC).
+ Effects:
+ record_full_reg:
+ 1 byte: record_type (record_full_reg, see enum record_full_type).
+ 4 bytes: Register ID.
+ n bytes: register value (n == actual register size).
+ record_full_mem:
+ 1 byte: record_type (record_full_mem, see enum record_full_type).
+ 4 bytes: memory length.
+ 8 bytes: memory address.
+ n bytes: memory value (n = memory length).
*/
/* bfdcore_read -- read bytes from a core file section. */
@@ -2400,9 +2422,14 @@ record_full_restore (struct bfd &cbfd)
/* Check the magic code. */
bfdcore_read (&cbfd, osec, &magic, sizeof (magic), &bfd_offset);
if (magic != RECORD_FULL_FILE_MAGIC)
- error (_("Version mismatch or file format error in core file %ps."),
- styled_string (file_name_style.style (),
- bfd_get_filename (&cbfd)));
+ {
+ if (magic == RECORD_FULL_FILE_MAGIC_OLD)
+ error (_("This old recording format is no longer supported."));
+ else
+ error (_("Version mismatch or file format error in core file %ps."),
+ styled_string (file_name_style.style (),
+ bfd_get_filename (&cbfd)));
+ }
if (record_debug)
gdb_printf (gdb_stdlog,
" Reading 4-byte magic cookie "
--
2.54.0
next prev parent reply other threads:[~2026-05-15 16:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 16:36 [PATCH v3 0/7] refactor the internals of record-full Guinevere Larsen
2026-05-15 16:36 ` [PATCH v3 1/7] gdb/record: Refactor record history Guinevere Larsen
2026-05-26 8:33 ` Schimpe, Christina
2026-05-28 13:20 ` Guinevere Larsen
2026-05-29 13:47 ` Schimpe, Christina
2026-05-15 16:36 ` [PATCH v3 2/7] gdb/record: remove record_full_insn_num Guinevere Larsen
2026-05-26 8:35 ` Schimpe, Christina
2026-05-15 16:37 ` [PATCH v3 3/7] gdb/record: c++ify internal structures of record-full.c Guinevere Larsen
2026-05-26 9:00 ` Schimpe, Christina
2026-05-27 20:13 ` Guinevere Larsen
2026-05-29 12:09 ` Schimpe, Christina
2026-05-29 16:38 ` Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 4/7] gdb/record: make record_full_history more c++-like Guinevere Larsen
2026-05-16 1:03 ` Thiago Jung Bauermann
2026-05-26 9:04 ` Schimpe, Christina
2026-05-26 20:07 ` Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 5/6] gdb/record: Define new version of the record-save section Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 5/7] gdb/record: extract the PC to record_full_instruction Guinevere Larsen
2026-05-16 1:04 ` Thiago Jung Bauermann
2026-05-29 12:40 ` Schimpe, Christina
2026-06-01 20:24 ` Guinevere Larsen
2026-05-15 16:37 ` Guinevere Larsen [this message]
2026-05-15 16:37 ` [PATCH v3 6/6] gdb/record: rename record_full_list to record_full_log Guinevere Larsen
2026-05-29 12:05 ` Schimpe, Christina
2026-05-15 16:37 ` [PATCH v3 7/7] " Guinevere Larsen
2026-05-16 1:07 ` Thiago Jung Bauermann
2026-05-15 17:45 ` [PATCH v3 0/7] refactor the internals of record-full Guinevere Larsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260515163706.3355686-8-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=thiago.bauermann@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox