]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/tdep] Use symbolic constants in s390_prologue_frame_unwind_cache
authorTom de Vries <tdevries@suse.de>
Thu, 9 Jan 2025 13:32:19 +0000 (14:32 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 9 Jan 2025 13:32:19 +0000 (14:32 +0100)
In s390_prologue_frame_unwind_cache there are two loops using a hardcoded
constant 16:
...
  for (i = 0; i < 16; i++)
    if (s390_register_call_saved (gdbarch, S390_R0_REGNUM + i)
  ...
  for (i = 0; i < 16; i++)
    if (s390_register_call_saved (gdbarch, S390_F0_REGNUM + i)
...

Fix this by using symbolic constants S390_NUM_GPRS and S390_NUM_FPRS instead.

Tested on s390x-linux, by rebuilding.

Approved-By: Andreas Arnez <arnez@linux.ibm.com>
gdb/s390-tdep.c

index 3a672b3869d85b836cd3d6016bfec74d74fd4f8d..70affc914c2b0151bce2ed454ba53045bd441a18 100644 (file)
@@ -2532,12 +2532,12 @@ s390_prologue_frame_unwind_cache (const frame_info_ptr &this_frame,
      ABI; for call-clobbered registers the parser may have recognized
      spurious stores.  */
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < S390_NUM_GPRS; i++)
     if (s390_register_call_saved (gdbarch, S390_R0_REGNUM + i)
        && data.gpr_slot[i] != 0)
       info->saved_regs[S390_R0_REGNUM + i].set_addr (cfa - data.gpr_slot[i]);
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < S390_NUM_FPRS; i++)
     if (s390_register_call_saved (gdbarch, S390_F0_REGNUM + i)
        && data.fpr_slot[i] != 0)
       info->saved_regs[S390_F0_REGNUM + i].set_addr (cfa - data.fpr_slot[i]);