public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address.
@ 2022-04-01 20:19 John Baldwin
  0 siblings, 0 replies; only message in thread
From: John Baldwin @ 2022-04-01 20:19 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c13566fdd5725d4c337a2741be02c12c4f430022

commit c13566fdd5725d4c337a2741be02c12c4f430022
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Fri Apr 1 13:16:46 2022 -0700

    Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address.
    
    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.

Diff:
---
 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-01 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 20:19 [binutils-gdb] Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address John Baldwin

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