From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2607:f138:0:13::2]) by sourceware.org (Postfix) with ESMTPS id 526E33858D3C; Thu, 24 Mar 2022 20:56:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 526E33858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 99A5B1A84E1C; Thu, 24 Mar 2022 16:56:23 -0400 (EDT) From: John Baldwin To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH 2/5] Recognize FreeBSD core dump note for x86 segment base registers. Date: Thu, 24 Mar 2022 13:56:13 -0700 Message-Id: <20220324205616.8517-3-jhb@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220324205616.8517-1-jhb@FreeBSD.org> References: <20220324205616.8517-1-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Thu, 24 Mar 2022 16:56:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2022 20:56:25 -0000 This core dump note contains the value of the base address of the %fs and %gs segments for both i386 and amd64 core dumps. It is primarily useful in resolving the address of TLS variables in core dumps. binutils/ChangeLog: * readelf.c (get_freebsd_elfcore_note_type): Handle NT_FREEBSD_X86_SEGBASES. include/ChangeLog: * elf/common.h (NT_FREEBSD_X86_SEGBASES): Define. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 2 ++ include/ChangeLog | 4 ++++ include/elf/common.h | 1 + 4 files changed, 12 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index f84323953d6..b9df76e9e56 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2022-03-23 John Baldwin + + * readelf.c (get_freebsd_elfcore_note_type): Handle + NT_FREEBSD_X86_SEGBASES. + 2022-03-16 Fangrui Song PR binutils/28926 diff --git a/binutils/readelf.c b/binutils/readelf.c index a2dbaa4722e..84c8cfd45fc 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -20448,6 +20448,8 @@ get_freebsd_elfcore_note_type (Filedata * filedata, unsigned e_type) return _("NT_PROCSTAT_AUXV (auxv data)"); case NT_FREEBSD_PTLWPINFO: return _("NT_PTLWPINFO (ptrace_lwpinfo structure)"); + case NT_FREEBSD_X86_SEGBASES: + return _("NT_X86_SEGBASES (x86 segment base registers)"); } return get_note_type (filedata, e_type); } diff --git a/include/ChangeLog b/include/ChangeLog index 82194629c97..05d95e623b6 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2022-03-23 John Baldwin + + * elf/common.h (NT_FREEBSD_X86_SEGBASES): Define. + 2022-03-16 Simon Marchi * elf/amdgpu.h: Add relocation values. diff --git a/include/elf/common.h b/include/elf/common.h index 70d63e3299c..ad62a7d8523 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -738,6 +738,7 @@ #define NT_FREEBSD_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */ #define NT_FREEBSD_PROCSTAT_AUXV 16 /* Procstat auxv data. */ #define NT_FREEBSD_PTLWPINFO 17 /* Thread ptrace miscellaneous info. */ +#define NT_FREEBSD_X86_SEGBASES 0x200 /* x86 segment base registers */ /* Note segments for core files on NetBSD systems. Note name must start with "NetBSD-CORE". */ -- 2.34.1