aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-03-12 13:39:02 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2019-03-12 13:45:47 -0700
commit6e056c817845f3d736a1be6b68c69b439c6c6d25 (patch)
treec5757ebd000ccd8a2d63440d6ef19db9e8c89d8d /gdb/target.c
parentcd250a1898bb6fdb41f4a1063dbcfac04affcd11 (diff)
downloadgdb-6e056c817845f3d736a1be6b68c69b439c6c6d25.zip
gdb-6e056c817845f3d736a1be6b68c69b439c6c6d25.tar.gz
gdb-6e056c817845f3d736a1be6b68c69b439c6c6d25.tar.bz2
Add a new gdbarch method to resolve the address of TLS variables.
Permit TLS variable addresses to be resolved purely by an ABI rather than requiring a target method. This doesn't try the target method if the ABI function is present (even if the ABI function fails) to simplify error handling. gdb/ChangeLog: * gdbarch.sh (get_thread_local_address): New method. * gdbarch.h, gdbarch.c: Regenerate. * target.c (target_translate_tls_address): Use gdbarch_get_thread_local_address if present instead of target::get_thread_local_address.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 8579c19..c27157d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -698,8 +698,9 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
{
volatile CORE_ADDR addr = 0;
struct target_ops *target = current_top_target ();
+ struct gdbarch *gdbarch = target_gdbarch ();
- if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
+ if (gdbarch_fetch_tls_load_module_address_p (gdbarch))
{
ptid_t ptid = inferior_ptid;
@@ -708,10 +709,14 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
CORE_ADDR lm_addr;
/* Fetch the load module address for this objfile. */
- lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (),
+ lm_addr = gdbarch_fetch_tls_load_module_address (gdbarch,
objfile);
- addr = target->get_thread_local_address (ptid, lm_addr, offset);
+ if (gdbarch_get_thread_local_address_p (gdbarch))
+ addr = gdbarch_get_thread_local_address (gdbarch, ptid, lm_addr,
+ offset);
+ else
+ addr = target->get_thread_local_address (ptid, lm_addr, offset);
}
/* If an error occurred, print TLS related messages here. Otherwise,
throw the error to some higher catcher. */
@@ -766,8 +771,6 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
}
END_CATCH
}
- /* It wouldn't be wrong here to try a gdbarch method, too; finding
- TLS is an ABI-specific thing. But we don't do that yet. */
else
error (_("Cannot find thread-local variables on this target"));