gdb/gdb-tdep-fix-recording-of-t1-push.patch
Tom de Vries f61a679e8e - Maintenance script qa.sh:
* Fix 16.0 handling.
- Patches added:
  * gdb-testsuite-fix-gdb.python-py-format-string.exp-wi.patch
  * gdb-testsuite-fix-gdb.python-py-mi-cmd.exp-with-pyth.patch
  * gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-on-arm-lin.patch
  * gdb-testsuite-fix-regexp-in-gdb.ada-mi_var_access.ex.patch
  * gdb-testsuite-check-gnatmake-version-in-gdb.ada-scal.patch
  * gdb-testsuite-fix-gdb.arch-arm-pseudo-unwind.exp-wit.patch
  * gdb-symtab-fix-target-type-of-complex-long-double-on.patch
  * gdb-testsuite-don-t-use-set-auto-solib-add-off.patch
  * gdb-tdep-fix-arm-thumb2-hw-breakpoint.patch
  * gdb-testsuite-fix-gdb.cp-m-static.exp-on-arm.patch
  * gdb-testsuite-fix-gdb.dwarf2-dw2-fixed-point.exp-on-.patch
  * gdb-testsuite-fix-gdb.dwarf2-dw2-lines.exp-on-arm-li.patch
  * gdb-exp-fix-gdb.fortran-intrinsics.exp-fail-on-arm.patch
  * gdb-tdep-handle-sycall-statx-for-arm-linux.patch
  * gdb-tdep-fix-recording-of-t1-push.patch
  * gdb-tdep-handle-syscall-clock_gettime64-for-arm-linu.patch
  * fix-gdb.dwarf2-shortpiece.exp-on-s390x.patch
  * handle-address-class-annotation-for-s390x-in-some-te.patch
  * fix-gdb.dap-step-out.exp-on-s390x.patch
  * use-setvariable-in-gdb.dap-scopes.exp.patch
  * fix-gdb.base-finish-pretty.exp-on-s390x.patch
  * fix-gdb.base-readnever.exp-on-s390x.patch
  * add-dwarf_expr_piece.op.patch
  * add-gdbarch_dwarf2_reg_piece_offset-hook.patch
  * fix-gdb.base-store.exp-on-s390x.patch
  * fix-gdb.ada-o2_float_param.exp-on-s390x-linux.patch
  * gdb-testsuite-fix-gdb.base-branch-to-self.exp-on-arm.patch
  * gdb-tdep-fix-gdb.cp-non-trivial-retval.exp-on-riscv6.patch
  * gdb-testsuite-fix-gdb.cp-non-trivial-retval.exp-on-a.patch
  * gdb-testsuite-fix-gdb.rust-completion.exp-timeout-on.patch
  * gdb-testsuite-require-supports_process_record-in-gdb.patch
  * gdb-testsuite-fix-regexp-in-gdb.arch-i386-disp-step-.patch
  * gdb-testsuite-fix-gdb.arch-arm-single-step-kernel-he.patch
  * gdb-testsuite-fix-gdb.python-py-format-address.exp-o.patch
  * gdb-testsuite-fix-gdb.arch-riscv-tdesc-regs.exp.patch
  * gdb-testsuite-fix-gdb.base-list-dot-nodebug-and-make.patch
  * gdb-testsuite-fix-gdb.base-list-dot-nodebug.exp-on-o.patch
  * gdb-testsuite-fix-gdb.base-empty-host-env-vars.exp.patch
  * gdb-prune-inferior-after-switching-inferior.patch
  * gdb-testsuite-use-nostdlib-in-gdb.base-list-dot-node.patch
  * gdb-testsuite-fix-timeout-in-gdb.mi-mi-multi-command.patch
  * gdb-testsuite-require-can_spawn_for_attach-in-gdb.ba.patch
  * fixup-gdb-6.5-gcore-buffer-limit-test.patch
  * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-on-s3.patch
  * gdb-testsuite-fix-gdb.ada-convvar_comp.exp-on-s390x-.patch
  * gdb-testsuite-fix-regexp-in-gdb.threads-stepi-over-c.patch

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=437
2025-02-13 14:36:11 +00:00

70 lines
2.3 KiB
Diff

From 0494211cb5f418654ca3a4ac1b9f10518426732f Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 13 Nov 2024 19:44:21 +0100
Subject: [PATCH 15/46] [gdb/tdep] Fix recording of T1 push
When running test-case gdb.reverse/recursion.exp on arm-linux with target
board unix/-mthumb, I run into:
...
(gdb) PASS: gdb.reverse/recursion.exp: Skipping recursion from inside
reverse-next^M
bar (x=4195569) at /home/linux/gdb/src/gdb/testsuite/gdb.reverse/recursion.c:34^M
34 int r = foo (x);^M
(gdb) FAIL: gdb.reverse/recursion.exp: print frame when stepping out
...
The problem is the recording of the T1 push instruction [1,2], specifically:
...
000004d8 <foo>:
4d8: b580 push {r7, lr}
...
The current code fails to add a memory record for the memory written with the
value of the lr register.
Fix this by adding the missing memory record.
Tested on arm-linux.
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Luis Machado <luis.machado@arm.com>
[1] https://developer.arm.com/documentation/ddi0406/c/Application-Level-Architecture/Instruction-Details/Encoding-of-lists-of-ARM-core-registers
[2] https://developer.arm.com/documentation/ddi0597/2024-09/T32-Instructions-by-Encoding/16-bit?lang=en#pushpop16
---
gdb/arm-tdep.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f36ce631a08..d898a426609 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -13561,9 +13561,12 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
record_buf[0] = bits (thumb_insn_r->arm_insn, 0, 2);
thumb_insn_r->reg_rec_count = 1;
break;
- case 4: /* fall through */
case 5:
- /* PUSH. */
+ /* PUSH with lr. */
+ register_count++;
+ [[fallthrough]];
+ case 4:
+ /* PUSH without lr. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
regcache_raw_read_unsigned (reg_cache, ARM_SP_REGNUM, &u_regval);
while (register_bits)
@@ -13572,8 +13575,7 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
register_count++;
register_bits = register_bits >> 1;
}
- start_address = u_regval - \
- (4 * (bit (thumb_insn_r->arm_insn, 8) + register_count));
+ start_address = u_regval - (4 * register_count);
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
{
--
2.43.0