From 7fb4db4c6316347a83b152d94c9aa74641b970dc Mon Sep 17 00:00:00 2001 From: Guinevere Larsen Date: Thu, 28 Aug 2025 10:40:34 -0300 Subject: [PATCH] gdb/riscv/record: remove possibility of recording an empty instruction When recording instructions in a riscv CPU, the function riscv_process_record works in 2 steps: first, it disassembles the current instruction and creates std::vectors with all the data that will be changed (in the "record" method), and then those get added to the history in a helper function. If the disassembly fails, the process_record function will add a new "end instruction" marker to the recorded history. And that is where the issue happens. Because the previous instruction must already have added an "end" marker and no new information has been added, since it was only disassembly, the end result is having an empty instruction in the history, which will be fully redundant. This commit just removes the end marker addition. Approved-By: Guinevere Larsen --- gdb/riscv-tdep.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 6fd7c616664..697071bf69e 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -5579,10 +5579,7 @@ riscv_process_record (struct gdbarch *gdbarch, struct regcache *regcache, riscv_recorded_insn insn; if (!insn.record (gdbarch, regcache, addr)) - { - record_full_arch_list_add_end (); - return -1; - } + return -1; int ret_val = riscv_record_insn_details (gdbarch, regcache, insn); -- 2.47.3