From patchwork Mon Jan 11 18:54:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 10332 Received: (qmail 121513 invoked by alias); 11 Jan 2016 18:54:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 121429 invoked by uid 89); 11 Jan 2016 18:54:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.9 required=5.0 tests=AWL, BAYES_50, SPF_HELO_PASS, SPF_SOFTFAIL, UNWANTED_LANGUAGE_BODY autolearn=no version=3.3.2 spammy=auxv, 270, Variables, sk:freebsd X-Spam-User: qpsmtpd, 2 recipients X-HELO: bigwig.baldwin.cx Received: from bigwig.baldwin.cx (HELO bigwig.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 11 Jan 2016 18:54:11 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 60790B98C; Mon, 11 Jan 2016 13:54:09 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH 1/6] Add support to readelf for reading FreeBSD ELF core notes. Date: Mon, 11 Jan 2016 10:54:08 -0800 Message-ID: <2425798.gOXo57LWpj@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) MIME-Version: 1.0 X-IsSubscribed: yes binutils/ChangeLog: * readelf.c (get_freebsd_elfcore_note_type): New (process_note): Add support for FreeBSD core notes. include/elf/ChangeLog: * 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. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 35 +++++++++++++++++++++++++++++++++++ include/elf/ChangeLog | 27 +++++++++++++++++++++++++++ include/elf/common.h | 14 ++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 include/elf/ChangeLog diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 21dcb2c..47773c9 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2016-01-09 John Baldwin + + * readelf.c (get_freebsd_elfcore_note_type): New + (process_note): Add support for FreeBSD core notes. + 2016-01-01 Alan Modra Update year range in copyright notice of all files. diff --git a/binutils/readelf.c b/binutils/readelf.c index 47ac1ad..fa9cda1 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -15388,6 +15388,37 @@ process_netbsd_elf_note (Elf_Internal_Note * pnote) } 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) { static char buff[64]; @@ -15636,6 +15667,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/elf/ChangeLog b/include/elf/ChangeLog new file mode 100644 index 0000000..821a8bc --- /dev/null +++ b/include/elf/ChangeLog @@ -0,0 +1,27 @@ +2016-01-09 John Baldwin + + * 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. + +For older changes see ChangeLog-0415 + +Copyright (C) 2016 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/include/elf/common.h b/include/elf/common.h index ce506fc..767ad3e 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". */