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 5/5] Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address.
Date: Thu, 24 Mar 2022 13:56:16 -0700	[thread overview]
Message-ID: <20220324205616.8517-6-jhb@FreeBSD.org> (raw)
In-Reply-To: <20220324205616.8517-1-jhb@FreeBSD.org>

32-bit x86 arches always the I386_*BASE_REGNUM values.  Only code that
needs to support both 64-bit and 32-bit arches needs to use
tdep->fsbase_regnum to compute a segment base register number.
---
 gdb/i386-fbsd-tdep.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index fad091f8472..d50f35707ee 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-tdep.c
@@ -350,16 +350,13 @@ i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
   i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   struct regcache *regcache;
 
-  if (tdep->fsbase_regnum == -1)
-    error (_("Unable to fetch %%gsbase"));
-
   regcache = get_thread_arch_regcache (current_inferior ()->process_target (),
 				       ptid, gdbarch);
 
-  target_fetch_registers (regcache, tdep->fsbase_regnum + 1);
+  target_fetch_registers (regcache, I386_GSBASE_REGNUM);
 
   ULONGEST gsbase;
-  if (regcache->cooked_read (tdep->fsbase_regnum + 1, &gsbase) != REG_VALID)
+  if (regcache->cooked_read (I386_GSBASE_REGNUM, &gsbase) != REG_VALID)
     error (_("Unable to fetch %%gsbase"));
 
   CORE_ADDR dtv_addr = gsbase + gdbarch_ptr_bit (gdbarch) / 8;
-- 
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 ` [PATCH 2/5] Recognize FreeBSD core dump note for x86 segment base registers John Baldwin
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 ` John Baldwin [this message]

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-6-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).