From fd2b4de5e63ad5994baf9c57b5d0c49d1f1dd4e4 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 26 Oct 2018 10:20:56 -0700 Subject: [PATCH] Treat all unknown auxv tags on FreeBSD as unknown. 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(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a91804de2e..a8d15aab036 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-10-26 John Baldwin + + * fbsd-tdep.c (fbsd_print_auxv_entry): Only use + default_print_auxv_entry for specific tag values. + 2018-10-26 John Baldwin * fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2. diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 4e9ea816c59..db9a2178ce6 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1500,12 +1500,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) \ @@ -1522,9 +1539,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); -- 2.30.2