diff options
author | emaste <emaste@FreeBSD.org> | 2013-07-18 17:25:50 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-07-18 17:25:50 +0000 |
commit | 71f36ebafc0f4422d0ac42c0b8d466d57f14bedd (patch) | |
tree | 259a4c07d4650d26064d28d2a1ecd8d13d220421 /contrib/binutils | |
parent | 110931b35d69de2ab71d15fa3c64a6b05797e419 (diff) | |
download | FreeBSD-src-71f36ebafc0f4422d0ac42c0b8d466d57f14bedd.zip FreeBSD-src-71f36ebafc0f4422d0ac42c0b8d466d57f14bedd.tar.gz |
Handle FreeBSD-specific ELF notes
Add a function to return the specific type, when the note's Name field is
'FreeBSD'.
r249558 added FreeBSD-specific ELF note types that reuse type numbers of
existing generic / Linux types. This caused 'readelf -n' to produce
incorrect output on FreeBSD core files.
Sponsored by: DARPA, AFRL
MFC after: 3 days
Diffstat (limited to 'contrib/binutils')
-rw-r--r-- | contrib/binutils/binutils/readelf.c | 39 | ||||
-rw-r--r-- | contrib/binutils/include/elf/common.h | 14 |
2 files changed, 50 insertions, 3 deletions
diff --git a/contrib/binutils/binutils/readelf.c b/contrib/binutils/binutils/readelf.c index 98249ff..ccbddf0 100644 --- a/contrib/binutils/binutils/readelf.c +++ b/contrib/binutils/binutils/readelf.c @@ -9103,8 +9103,6 @@ get_note_type (unsigned e_type) return _("NT_FPREGS (floating point registers)"); case NT_PSINFO: return _("NT_PSINFO (psinfo structure)"); - case NT_THRMISC: - return _("NT_THRMISC (thrmisc structure)"); case NT_LWPSTATUS: return _("NT_LWPSTATUS (lwpstatus_t structure)"); case NT_LWPSINFO: @@ -9130,6 +9128,39 @@ get_note_type (unsigned e_type) } static const char * +get_freebsd_elfcore_note_type (unsigned e_type) +{ + if (elf_header.e_type == ET_CORE) + switch (e_type) + { + case NT_THRMISC: + return _("NT_THRMISC (thrmisc structure)"); + case NT_PROCSTAT_PROC: + return _("NT_PROCSTAT_PROC (proc data)"); + case NT_PROCSTAT_FILES: + return _("NT_PROCSTAT_FILES (files data)"); + case NT_PROCSTAT_VMMAP: + return _("NT_PROCSTAT_VMMAP: (vmmap data)"); + case NT_PROCSTAT_GROUPS: + return _("NT_PROCSTAT_GROUPS: (groups data)"); + case NT_PROCSTAT_UMASK: + return _("NT_PROCSTAT_UMASK: (umask data)"); + case NT_PROCSTAT_RLIMIT: + return _("NT_PROCSTAT_RLIMIT: (rlimit data)"); + case NT_PROCSTAT_OSREL: + return _("NT_PROCSTAT_OSREL: (osreldate data)"); + case NT_PROCSTAT_PSSTRINGS: + return _("NT_PROCSTAT_PSSTRINGS: (ps_strings data)"); + case NT_PROCSTAT_AUXV: + return _("NT_PROCSTAT_AUXV: (auxv data)"); + default: + break; + } + + return get_note_type(e_type); +} + +static const char * get_netbsd_elfcore_note_type (unsigned e_type) { static char buff[64]; @@ -9206,6 +9237,10 @@ process_note (Elf_Internal_Note *pnote) note type strings. */ nt = get_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/contrib/binutils/include/elf/common.h b/contrib/binutils/include/elf/common.h index eb38192..92b8f4d 100644 --- a/contrib/binutils/include/elf/common.h +++ b/contrib/binutils/include/elf/common.h @@ -388,7 +388,6 @@ #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ #define NT_TASKSTRUCT 4 /* Contains copy of task struct */ #define NT_AUXV 6 /* Contains copy of Elfxx_auxv_t */ -#define NT_THRMISC 7 /* Contains copy of thrmisc struct */ #define NT_PRXFPREG 0x46e62b7f /* Contains a user_xfpregs_struct; */ /* note name must be "LINUX". */ @@ -401,6 +400,19 @@ #define NT_LWPSINFO 17 /* Has a struct lwpsinfo_t */ #define NT_WIN32PSTATUS 18 /* Has a struct win32_pstatus */ +/* Note segments for core files on FreeBSD systems. Note name + must start with "FreeBSD". */ +#define NT_THRMISC 7 /* Contains copy of thrmisc struct */ +#define NT_PROCSTAT_PROC 8 +#define NT_PROCSTAT_FILES 9 +#define NT_PROCSTAT_VMMAP 10 +#define NT_PROCSTAT_GROUPS 11 +#define NT_PROCSTAT_UMASK 12 +#define NT_PROCSTAT_RLIMIT 13 +#define NT_PROCSTAT_OSREL 14 +#define NT_PROCSTAT_PSSTRINGS 15 +#define NT_PROCSTAT_AUXV 16 + /* Note segments for core files on NetBSD systems. Note name must start with "NetBSD-CORE". */ |