[v4,7/8] gdb/record: Define new version of the record-save section
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
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(-)
Comments
> -----Original Message-----
> From: Guinevere Larsen <guinevere@redhat.com>
> Sent: Dienstag, 2. Juni 2026 16:34
> 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 v4 7/8] gdb/record: Define new version of the record-save
> section
>
> 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 7c8cf9af4c2..4dd3d84c19d 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 0dd4207e0c6..4e8326e1298
> 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.
>
> @@ -2214,6 +2215,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. */ @@ -2409,9
> +2431,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
>
LGTM.
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
Christina
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
@@ -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
@@ -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.
@@ -2214,6 +2215,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. */
@@ -2409,9 +2431,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 "