Source-Changes-HG archive

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

[src/trunk]: src/external/gpl3/gdb/dist/gdb Fix core-dump register fetching.



details:   https://anonhg.NetBSD.org/src/rev/99f8703a0183
branches:  trunk
changeset: 1003845:99f8703a0183
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 02 15:15:09 2019 +0000

description:
Fix core-dump register fetching.

diffstat:

 external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c |  62 +++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 1 deletions(-)

diffs (86 lines):

diff -r 49cdfe9e932b -r 99f8703a0183 external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c
--- a/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c        Wed Oct 02 11:18:55 2019 +0000
+++ b/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c        Wed Oct 02 15:15:09 2019 +0000
@@ -19,6 +19,8 @@
 
 #include "defs.h"
 #include "osabi.h"
+#include "gdbcore.h"
+#include "regset.h"
 
 #include "arch/arm.h"
 #include "arm-tdep.h"
@@ -36,6 +38,64 @@
 static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
 static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
 
+/* Register maps.  */
+
+static const struct regcache_map_entry arm_nbsd_gregmap[] =
+  {
+    { 13, ARM_A1_REGNUM, 4 }, /* r0 ... r12 */
+    { 1, ARM_SP_REGNUM, 4 },
+    { 1, ARM_LR_REGNUM, 4 },
+    { 1, ARM_PC_REGNUM, 4 },
+    { 1, ARM_PS_REGNUM, 4 },
+    { 0 }
+  };
+
+static const struct regcache_map_entry arm_nbsd_vfpregmap[] =
+  {
+    { 1, ARM_FPS_REGNUM, 4 },          /* fpexc */
+    { 1, ARM_FPSCR_REGNUM, 4 },                /* fpscr */
+    { 1, REGCACHE_MAP_SKIP, 4 },       /* fpinst */
+    { 1, REGCACHE_MAP_SKIP, 4 },       /* fpinst2 */
+    { 32, ARM_D0_REGNUM, 8 }, /* d0 ... d31 */ /* really 33, not 32 */
+    { 1, REGCACHE_MAP_SKIP, 8 },       /* fstmx format */
+    { 0 }
+  };
+
+/* Register set definitions.  */
+
+const struct regset arm_nbsd_gregset =
+  {
+    arm_nbsd_gregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
+const struct regset arm_nbsd_vfpregset =
+  {
+    arm_nbsd_vfpregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
+/* Implement the "regset_from_core_section" gdbarch method.  */
+
+#define ARM_NBSD_SIZEOF_GREGSET (17 * 4)
+#define ARM_NBSD_SIZEOF_VFPREGSET (4 * 4 + 33 * 8)
+
+static void
+arm_nbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                      iterate_over_regset_sections_cb *cb,
+                                      void *cb_data,
+                                      const struct regcache *regcache)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  cb (".reg", ARM_NBSD_SIZEOF_GREGSET, ARM_NBSD_SIZEOF_GREGSET,
+      &arm_nbsd_gregset, NULL, cb_data);
+
+  // XXX: Don't see it in core.
+  if (tdep->vfp_register_count > 0)
+    cb (".reg2", ARM_NBSD_SIZEOF_VFPREGSET, ARM_NBSD_SIZEOF_VFPREGSET,
+       &arm_nbsd_vfpregset, "VFP floating-point", cb_data);
+}
 static void
 arm_netbsd_init_abi_common (struct gdbarch_info info,
                            struct gdbarch *gdbarch)
@@ -71,7 +131,7 @@
   set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
   /* Core support */
   set_gdbarch_iterate_over_regset_sections
-    (gdbarch, armbsd_iterate_over_regset_sections);
+    (gdbarch, arm_nbsd_iterate_over_regset_sections);
 
 }
 



Home | Main Index | Thread Index | Old Index