Patchwork [2/2] Treat all unknown auxv tags on FreeBSD as unknown.

login
register
mail settings
Submitter John Baldwin
Date Oct. 8, 2018, 10:53 p.m.
Message ID <20181008225319.87243-2-jhb@FreeBSD.org>
Download mbox | patch
Permalink /patch/29675/
State New
Headers show

Comments

John Baldwin - Oct. 8, 2018, 10:53 p.m.
Previously, default_print_auxv_entry was called for any auxv entries
without a known AT_FREEBSD_* tag.  However, this resulted in false
positive matches when FreeBSD added a new tag that has an existing
AT_* tag with a different meaning.  Instead, only call
default_print_auxv_entry for specific tag values for which FreeBSD
matches the default AT_* values.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_print_auxv_entry): Only use
	default_print_auxv_entry for specific tag values.
---
 gdb/ChangeLog   |  5 +++++
 gdb/fbsd-tdep.c | 26 ++++++++++++++++++++------
 2 files changed, 25 insertions(+), 6 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 24aeb467b1..6300570b6f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-10-08  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_print_auxv_entry): Only use
+	default_print_auxv_entry for specific tag values.
+
 2018-10-08  John Baldwin  <jhb@FreeBSD.org>
 
 	* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2.
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index e948f28abc..28e8d0efc4 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1483,12 +1483,29 @@  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;
+  const char *name = "???";
+  const char *description = "";
+  enum auxv_format format = AUXV_FORMAT_HEX;
 
   switch (type)
     {
+    case AT_NULL:
+    case AT_IGNORE:
+    case AT_EXECFD:
+    case AT_PHDR:
+    case AT_PHENT:
+    case AT_PHNUM:
+    case AT_PAGESZ:
+    case AT_BASE:
+    case AT_FLAGS:
+    case AT_ENTRY:
+    case AT_NOTELF:
+    case AT_UID:
+    case AT_EUID:
+    case AT_GID:
+    case AT_EGID:
+      default_print_auxv_entry (gdbarch, file, type, val);
+      return;
 #define _TAGNAME(tag) #tag
 #define TAGNAME(tag) _TAGNAME(AT_##tag)
 #define TAG(tag, text, kind) \
@@ -1505,9 +1522,6 @@  fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
       TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX);
       TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX);
       TAG (HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
-    default:
-      default_print_auxv_entry (gdbarch, file, type, val);
-      return;
     }
 
   fprint_auxv_entry (file, name, description, format, type, val);