* [PATCH] gdb/record: remove PC member from record_full_instruction
@ 2026-11-25 19:28 Guinevere Larsen
2026-11-25 23:16 ` Kevin Buettner
0 siblings, 1 reply; 2+ messages in thread
From: Guinevere Larsen @ 2026-11-25 19:28 UTC (permalink / raw)
To: gdb-patches; +Cc: Guinevere Larsen
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
---
gdb/record-full.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 7b1d64069c7..228c25cf1cd 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -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<gdb_signal> sigval;
std::vector<record_full_entry> 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: 9e9d08ed5bc2237478299335351954dc50be5ffa
--
2.56.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb/record: remove PC member from record_full_instruction
2026-11-25 19:28 [PATCH] gdb/record: remove PC member from record_full_instruction Guinevere Larsen
@ 2026-11-25 23:16 ` Kevin Buettner
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2026-11-25 23:16 UTC (permalink / raw)
To: Guinevere Larsen, gdb-patches
On 11/25/26 12:28 PM, Guinevere Larsen wrote:
> 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
I ran this through my AI patch review workflow. While it wasn't able to
test on s390x, it did spot a minor problem - the lack of a version
number bump for the record-save file layout.
A NEWS file line mentioning this would probably be a good idea.
(You should seek approval for the NEWS entry from Eli.)
With the magic number bump, the coding parts of this change are
approved.
Approved-By: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 23:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 19:28 [PATCH] gdb/record: remove PC member from record_full_instruction Guinevere Larsen
2026-11-25 23:16 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox