public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
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	[thread overview]
Message-ID: <20220324205616.8517-3-jhb@FreeBSD.org> (raw)
In-Reply-To: <20220324205616.8517-1-jhb@FreeBSD.org>

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  <jhb@FreeBSD.org>
+
+	* readelf.c (get_freebsd_elfcore_note_type): Handle
+	NT_FREEBSD_X86_SEGBASES.
+
 2022-03-16  Fangrui Song  <maskray@google.com>
 
 	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  <jhb@FreeBSD.org>
+
+	* elf/common.h (NT_FREEBSD_X86_SEGBASES): Define.
+
 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
 
 	* 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


  parent reply	other threads:[~2022-03-24 20:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 20:56 [PATCH 0/5] Handle FreeBSD's NT_X86_SEGBASES core dump note John Baldwin
2022-03-24 20:56 ` [PATCH 1/5] elfcore_grok_freebsd_note: Remove checks of note->namesz John Baldwin
2022-03-24 20:56 ` John Baldwin [this message]
2022-03-24 20:56 ` [PATCH 3/5] Use pseudosections for NT_FREEBSD_X86_SEGBASES core dump notes John Baldwin
2022-03-24 20:56 ` [PATCH 4/5] FreeBSD/x86: Read segment base registers from NT_X86_SEGBASES John Baldwin
2022-03-24 20:56 ` [PATCH 5/5] Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address John Baldwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220324205616.8517-3-jhb@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).