Module Name:    src
Committed By:   rin
Date:           Thu Aug 17 04:54:59 UTC 2023

Modified Files:
        src/external/gpl3/gdb/dist/gdb: arm-netbsd-nat.c

Log Message:
gdb/arm: Handle discontinous range of GPR number, lost during merge

Add comment for future references.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c:1.4 src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c:1.5
--- src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c:1.4	Thu Aug 17 04:52:38 2023
+++ src/external/gpl3/gdb/dist/gdb/arm-netbsd-nat.c	Thu Aug 17 04:54:58 2023
@@ -38,6 +38,24 @@
 #include "netbsd-nat.h"
 #include "bsd-kvm.h"
 
+/* Determine if PT_GETREGS fetches REGNUM.  */
+
+static bool
+getregs_supplies (int regnum)
+{
+  return ((regnum >= ARM_A1_REGNUM && regnum <= ARM_PC_REGNUM)
+	  || regnum == ARM_PS_REGNUM);
+}
+
+/* Determine if PT_GETFPREGS fetches REGNUM.  */
+
+static bool
+getfpregs_supplies (int regnum)
+{
+  return ((regnum >= ARM_D0_REGNUM && regnum <= ARM_D31_REGNUM)
+	  || regnum == ARM_FPSCR_REGNUM);
+}
+
 class arm_netbsd_nat_target final : public nbsd_nat_target
 {
 public:
@@ -183,10 +201,15 @@ arm_netbsd_nat_target::fetch_registers (
 {
   if (regno >= 0)
     {
-      if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
+      /* Handle discontinuous range for general purpose registers.
+	 For floating-point registers, it happens to be continuous,
+	 but use specific static function for clarity.  */
+      if (getregs_supplies (regno))
 	fetch_register (regcache, regno);
-      else
+      else if (getfpregs_supplies (regno))
 	fetch_fp_register (regcache, regno);
+      else
+	warning (_("unable to fetch register %d"), regno);
     }
   else
     {

Reply via email to