Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/external/gpl3/gdb/dist/gdb Pull up following revision(s) ...



details:   https://anonhg.NetBSD.org/src/rev/69cb2daf9dc2
branches:  netbsd-9
changeset: 454973:69cb2daf9dc2
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 03 17:33:42 2019 +0000

description:
Pull up following revision(s) (requested by christos in ticket #281):

        external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c: revision 1.13

Validate register number before fetching/storing it (Gopikrishnan Sidhardhan)

diffstat:

 external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c |  30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r 4db6dbc82387 -r 69cb2daf9dc2 external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c
--- a/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c Thu Oct 03 17:32:32 2019 +0000
+++ b/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c Thu Oct 03 17:33:42 2019 +0000
@@ -49,6 +49,24 @@
 
 static arm_nbsd_nat_target the_arm_nbsd_nat_target;
 
+/* 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);
+}
+
 extern int arm_apcs_32;
 
 #define FPSCR(r) ((char *) &(r)->fpr_vfp.vfp_fpscr)
@@ -256,10 +274,12 @@
 {
   if (regno >= 0)
     {
-      if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+      if (getregs_supplies (regno))
+       fetch_register (regcache, regno);
+      else if (getfpregs_supplies (regno))
        fetch_fp_register (regcache, regno);
       else
-       fetch_register (regcache, regno);
+        warning (_("unable to fetch register %d"), regno);
     }
   else
     {
@@ -442,10 +462,12 @@
 {
   if (regno >= 0)
     {
-      if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+      if (getregs_supplies (regno))
+       store_register (regcache, regno);
+      else if (getfpregs_supplies (regno))
        store_fp_register (regcache, regno);
       else
-       store_register (regcache, regno);
+        warning (_("unable to store register %d"), regno);
     }
   else
     {



Home | Main Index | Thread Index | Old Index