From fc238d4a066cdb1a979475ffdf5bd45cdb8a00f0 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 9 Jul 2020 09:39:05 -0700 Subject: [PATCH] Support several new ELF auxiliary vector types on FreeBSD. FreeBSD's kernel recently added several ELF auxiliary vector entries to describe the arguments passed to new executable images during exec(). The AT_FREEBSD_ARGC and AT_FREEBSD_ARGV entries give the length and address of the process argument array. AT_FREEBSD_ENVC and AT_FREEBSD_ENVV entries give the length and address of the initial process environment. AT_FREEBSD_PS_STRINGS gives the address of the 'struct ps_strings' object. include/ChangeLog: * elf/common.h (AT_FREEBSD_ARGC, AT_FREEBSD_ARGV, AT_FREEBSD_ENVC) (AT_FREEBSD_ENVV, AT_FREEBSD_PS_STRINGS): Define. gdb/ChangeLog: * fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_ARGC, AT_FREEBSD_ARGV, AT_FREEBSD_ENVC, AT_FREEBSD_ENVV, AT_FREEBSD_PS_STRINGS. --- gdb/ChangeLog | 6 ++++++ gdb/fbsd-tdep.c | 5 +++++ include/ChangeLog | 5 +++++ include/elf/common.h | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index df9bc04c874..40e22efd7eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-07-09 John Baldwin + + * fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_ARGC, + AT_FREEBSD_ARGV, AT_FREEBSD_ENVC, AT_FREEBSD_ENVV, + AT_FREEBSD_PS_STRINGS. + 2020-07-08 Hannes Domani * auto-load.c (auto_load_objfile_script_1): Convert drive part diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index acf787c706a..557c5d3d737 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1598,6 +1598,11 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX); TAG (HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX); TAG (BSDFLAGS, _("ELF BSD flags"), AUXV_FORMAT_HEX); + TAG (ARGC, _("Argument count"), AUXV_FORMAT_DEC); + TAG (ARGV, _("Argument vector"), AUXV_FORMAT_HEX); + TAG (ENVC, _("Environment count"), AUXV_FORMAT_DEC); + TAG (ENVV, _("Environment vector"), AUXV_FORMAT_HEX); + TAG (PS_STRINGS, _("Pointer to ps_strings"), AUXV_FORMAT_HEX); } fprint_auxv_entry (file, name, description, format, type, val); diff --git a/include/ChangeLog b/include/ChangeLog index 1d7cafbe54d..49b9f038fa0 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2020-07-09 John Baldwin + + * elf/common.h (AT_FREEBSD_ARGC, AT_FREEBSD_ARGV, AT_FREEBSD_ENVC) + (AT_FREEBSD_ENVV, AT_FREEBSD_PS_STRINGS): Define. + 2020-07-09 Alan Modra * coff/powerpc.h: Delete. diff --git a/include/elf/common.h b/include/elf/common.h index 4d94c4fd5b3..88dd1c9983b 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1255,6 +1255,11 @@ #define AT_FREEBSD_HWCAP 25 /* CPU feature flags. */ #define AT_FREEBSD_HWCAP2 26 /* CPU feature flags 2. */ #define AT_FREEBSD_BSDFLAGS 27 /* ELF BSD Flags. */ +#define AT_FREEBSD_ARGC 28 /* Argument count. */ +#define AT_FREEBSD_ARGV 29 /* Argument vector. */ +#define AT_FREEBSD_ENVC 30 /* Environment count. */ +#define AT_FREEBSD_ENVV 31 /* Environment vvector. */ +#define AT_FREEBSD_PS_STRINGS 32 /* struct ps_strings. */ #define AT_SUN_UID 2000 /* Effective user ID. */ #define AT_SUN_RUID 2001 /* Real user ID. */ -- 2.30.2