Add a gdbarch 'print_auxv_entry' method for FreeBSD ABIs.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 16 Jun 2016 04:33:42 +0000 (21:33 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 24 Jun 2016 17:35:11 +0000 (10:35 -0700)
Add a 'print_auxv_entry' method for FreeBSD ABIs that parses
FreeBSD-specific auxiliary vector entries and outputs a suitable
description using fprint_auxv_entry.

gdb/ChangeLog:

* fbsd-tdep.c: Include "auxv.h".
(fbsd_print_auxv_entry): New function.
(fbsd_init_abi): Install gdbarch "print_auxv_entry" method.

gdb/ChangeLog
gdb/fbsd-tdep.c

index c7c71d7b974f2758faaa966c1a8df805355e72c3..22234be5d72b0d6aa543825f4e063caf34ea760a 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-24  John Baldwin  <jhb@FreeBSD.org>
+
+       * fbsd-tdep.c: Include "auxv.h".
+       (fbsd_print_auxv_entry): New function.
+       (fbsd_init_abi): Install gdbarch "print_auxv_entry" method.
+
 2016-06-24  John Baldwin  <jhb@FreeBSD.org>
 
        * auxv.c (fprint_auxv_entry): New function.
index 7310ea09208cc066f612275e8ead6ff38a3421b6..e8f860538e451a7d6865588048b19fe99263b86f 100644 (file)
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "auxv.h"
 #include "gdbcore.h"
 #include "inferior.h"
 #include "regcache.h"
@@ -283,6 +284,39 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   return note_data;
 }
 
+/* Print descriptions of FreeBSD-specific AUXV entries to FILE.  */
+
+static void
+fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
+                      CORE_ADDR type, CORE_ADDR val)
+{
+  const char *name;
+  const char *description;
+  enum auxv_format format;
+
+  switch (type)
+    {
+#define _TAGNAME(tag) #tag
+#define TAGNAME(tag) _TAGNAME(AT_##tag)
+#define TAG(tag, text, kind) \
+      case AT_FREEBSD_##tag: name = TAGNAME(tag); description = text; format = kind; break
+      TAG (EXECPATH, _("Executable path"), AUXV_FORMAT_STR);
+      TAG (CANARY, _("Canary for SSP"), AUXV_FORMAT_HEX);
+      TAG (CANARYLEN, ("Length of the SSP canary"), AUXV_FORMAT_DEC);
+      TAG (OSRELDATE, _("OSRELDATE"), AUXV_FORMAT_DEC);
+      TAG (NCPUS, _("Number of CPUs"), AUXV_FORMAT_DEC);
+      TAG (PAGESIZES, _("Pagesizes"), AUXV_FORMAT_HEX);
+      TAG (PAGESIZESLEN, _("Number of pagesizes"), AUXV_FORMAT_DEC);
+      TAG (TIMEKEEP, _("Pointer to timehands"), AUXV_FORMAT_HEX);
+      TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX);
+    default:
+      default_print_auxv_entry (gdbarch, file, type, val);
+      return;
+    }
+
+  fprint_auxv_entry (file, name, description, format, type, val);
+}
+
 /* To be called from GDB_OSABI_FREEBSD_ELF handlers. */
 
 void
@@ -291,4 +325,5 @@ fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_core_pid_to_str (gdbarch, fbsd_core_pid_to_str);
   set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name);
   set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes);
+  set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry);
 }
This page took 0.034241 seconds and 4 git commands to generate.