From: John Baldwin Date: Mon, 14 Dec 2015 06:26:19 +0000 (-0800) Subject: Add support to readelf for reading FreeBSD ELF core notes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4ddf30f1108b2c0b3eee5677c912383ac903256;p=binutils-gdb.git Add support to readelf for reading FreeBSD ELF core notes. binutils/ChangeLog: * readelf.c (get_freebsd_elfcore_note_type): New (process_note): Add support for FreeBSD core notes. include/ChangeLog: * elf/common.h (NT_FREEBSD_THRMISC): Define. (NT_FREEBSD_PROCSTAT_PROC): Define. (NT_FREEBSD_PROCSTAT_FILES): Define. (NT_FREEBSD_PROCSTAT_VMMAP): Define. (NT_FREEBSD_PROCSTAT_GROUPS): Define. (NT_FREEBSD_PROCSTAT_UMASK): Define. (NT_FREEBSD_PROCSTAT_RLIMIT): Define. (NT_FREEBSD_PROCSTAT_OSREL): Define. (NT_FREEBSD_PROCSTAT_PSSTRINGS): Define. (NT_FREEBSD_PROCSTAT_AUXV): Define. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1db49d241fb..16360453dc1 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2016-01-19 John Baldwin + + * readelf.c (get_freebsd_elfcore_note_type): New + (process_note): Add support for FreeBSD core notes. + 2016-01-18 Miranda Cupertino Zissulescu Claudiu diff --git a/binutils/readelf.c b/binutils/readelf.c index 73913347de2..01e3923d852 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -15410,6 +15410,37 @@ process_netbsd_elf_note (Elf_Internal_Note * pnote) return 1; } +static const char * +get_freebsd_elfcore_note_type (unsigned e_type) +{ + static char buff[64]; + + switch (e_type) + { + case NT_FREEBSD_THRMISC: + return _("NT_THRMISC (thrmisc structure)"); + case NT_FREEBSD_PROCSTAT_PROC: + return _("NT_PROCSTAT_PROC (proc data)"); + case NT_FREEBSD_PROCSTAT_FILES: + return _("NT_PROCSTAT_FILES (files data)"); + case NT_FREEBSD_PROCSTAT_VMMAP: + return _("NT_PROCSTAT_VMMAP (vmmap data)"); + case NT_FREEBSD_PROCSTAT_GROUPS: + return _("NT_PROCSTAT_GROUPS (groups data)"); + case NT_FREEBSD_PROCSTAT_UMASK: + return _("NT_PROCSTAT_UMASK (umask data)"); + case NT_FREEBSD_PROCSTAT_RLIMIT: + return _("NT_PROCSTAT_RLIMIT (rlimit data)"); + case NT_FREEBSD_PROCSTAT_OSREL: + return _("NT_PROCSTAT_OSREL (osreldate data)"); + case NT_FREEBSD_PROCSTAT_PSSTRINGS: + return _("NT_PROCSTAT_PSSTRINGS (ps_strings data)"); + case NT_FREEBSD_PROCSTAT_AUXV: + return _("NT_PROCSTAT_AUXV (auxv data)"); + } + return get_note_type (e_type); +} + static const char * get_netbsd_elfcore_note_type (unsigned e_type) { @@ -15659,6 +15690,10 @@ process_note (Elf_Internal_Note * pnote) /* GNU-specific object file notes. */ nt = get_gnu_elf_note_type (pnote->type); + else if (const_strneq (pnote->namedata, "FreeBSD")) + /* FreeBSD-specific core file notes. */ + nt = get_freebsd_elfcore_note_type (pnote->type); + else if (const_strneq (pnote->namedata, "NetBSD-CORE")) /* NetBSD-specific core file notes. */ nt = get_netbsd_elfcore_note_type (pnote->type); diff --git a/include/ChangeLog b/include/ChangeLog index 4195e474c73..cbd40b2581c 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,16 @@ +2016-01-19 John Baldwin + + * elf/common.h (NT_FREEBSD_THRMISC): Define. + (NT_FREEBSD_PROCSTAT_PROC): Define. + (NT_FREEBSD_PROCSTAT_FILES): Define. + (NT_FREEBSD_PROCSTAT_VMMAP): Define. + (NT_FREEBSD_PROCSTAT_GROUPS): Define. + (NT_FREEBSD_PROCSTAT_UMASK): Define. + (NT_FREEBSD_PROCSTAT_RLIMIT): Define. + (NT_FREEBSD_PROCSTAT_OSREL): Define. + (NT_FREEBSD_PROCSTAT_PSSTRINGS): Define. + (NT_FREEBSD_PROCSTAT_AUXV): Define. + 2016-01-18 Miranda Cupertino Zissulescu Claudiu diff --git a/include/elf/common.h b/include/elf/common.h index ce506fcbb92..767ad3ef13c 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -595,6 +595,20 @@ /* Note segment for SystemTap probes. */ #define NT_STAPSDT 3 +/* Note segments for core files on FreeBSD systems. Note name is + "FreeBSD". */ + +#define NT_FREEBSD_THRMISC 7 /* Thread miscellaneous info. */ +#define NT_FREEBSD_PROCSTAT_PROC 8 /* Procstat proc data. */ +#define NT_FREEBSD_PROCSTAT_FILES 9 /* Procstat files data. */ +#define NT_FREEBSD_PROCSTAT_VMMAP 10 /* Procstat vmmap data. */ +#define NT_FREEBSD_PROCSTAT_GROUPS 11 /* Procstat groups data. */ +#define NT_FREEBSD_PROCSTAT_UMASK 12 /* Procstat umask data. */ +#define NT_FREEBSD_PROCSTAT_RLIMIT 13 /* Procstat rlimit data. */ +#define NT_FREEBSD_PROCSTAT_OSREL 14 /* Procstat osreldate data. */ +#define NT_FREEBSD_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */ +#define NT_FREEBSD_PROCSTAT_AUXV 16 /* Procstat auxv data. */ + /* Note segments for core files on NetBSD systems. Note name must start with "NetBSD-CORE". */