summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2005-03-31 19:58:26 +0000
committerKevin Buettner <kevinb@redhat.com>2005-03-31 19:58:26 +0000
commitb27569303241f8fde83dc9f8ea6ba6193e32a419 (patch)
tree184d54bcc4b4cd2bba010f82e95fb097ae6621bc
parent0e867e795772266c7c4f360f0e0ef4c9f9c2c93a (diff)
downloadbinutils-gdb-b27569303241f8fde83dc9f8ea6ba6193e32a419.tar.gz
* gdbarch.sh (fetch_tls_load_module_address): New architecture method.
* gdbarch.c, gdbarch.h: Regenerate. * dwarf2loc.c (dwarf_expr_tls_address): Fetch TLS load module address and pass this address, instead of the objfile address, to target_get_thread_local_address(). * linux-thread-db.c (thread_db_get_thread_local_address): Change second parameter from type ``struct objfile *'' to CORE_ADDR. Do not call svr4_fetch_objfile_link_map() to fetch the load module address. * target.h (struct target_ops): Change second parameter of ``to_get_thread_local_address'' from ``struct objfile *'' to ``CORE_ADDR''. * alpha-linux-tdep.c (solib-svr4.h): Include. (alpha_linux_init_abi): Register TLS load module fetcher. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. * hppa-linux-tdep.c (hppa_linux_init_abi): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * ia64-linux-tdep.c (solib-svr4.h): Include. (ia64_linux_init_abi): Register TLS load module fetcher. * m32r-linux-tdep.c (m32r_linux_init_abi): Likewise. * m68klinux-tdep.c (m68k_linux_init_abi): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * s390-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (solib-svr4.h): Include. (sparc64_linux_init_abi): Register TLS load module fetcher. * Makefile.in (alpha-linux-tdep.o, ia64-linux-tdep.o) (sparc-linux-tdep.o): Update dependencies.
-rw-r--r--gdb/ChangeLog31
-rw-r--r--gdb/Makefile.in6
-rw-r--r--gdb/alpha-linux-tdep.c5
-rw-r--r--gdb/amd64-linux-tdep.c4
-rw-r--r--gdb/arm-linux-tdep.c4
-rw-r--r--gdb/dwarf2loc.c19
-rw-r--r--gdb/gdbarch.c45
-rw-r--r--gdb/gdbarch.h27
-rwxr-xr-xgdb/gdbarch.sh3
-rw-r--r--gdb/hppa-linux-tdep.c4
-rw-r--r--gdb/i386-linux-tdep.c4
-rw-r--r--gdb/ia64-linux-tdep.c5
-rw-r--r--gdb/linux-thread-db.c23
-rw-r--r--gdb/m32r-linux-tdep.c4
-rw-r--r--gdb/m68klinux-tdep.c4
-rw-r--r--gdb/mips-linux-tdep.c4
-rw-r--r--gdb/ppc-linux-tdep.c4
-rw-r--r--gdb/s390-tdep.c4
-rw-r--r--gdb/sparc-linux-tdep.c4
-rw-r--r--gdb/sparc64-linux-tdep.c5
-rw-r--r--gdb/target.h2
21 files changed, 189 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2de1fd9b6a..7b94a88ff98 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+2005-03-31 Kevin Buettner <kevinb@redhat.com>
+
+ * gdbarch.sh (fetch_tls_load_module_address): New architecture method.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * dwarf2loc.c (dwarf_expr_tls_address): Fetch TLS load module
+ address and pass this address, instead of the objfile address, to
+ target_get_thread_local_address().
+ * linux-thread-db.c (thread_db_get_thread_local_address): Change
+ second parameter from type ``struct objfile *'' to CORE_ADDR. Do
+ not call svr4_fetch_objfile_link_map() to fetch the load module
+ address.
+ * target.h (struct target_ops): Change second parameter of
+ ``to_get_thread_local_address'' from ``struct objfile *'' to
+ ``CORE_ADDR''.
+ * alpha-linux-tdep.c (solib-svr4.h): Include.
+ (alpha_linux_init_abi): Register TLS load module fetcher.
+ * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
+ * hppa-linux-tdep.c (hppa_linux_init_abi): Likewise.
+ * i386-linux-tdep.c (i386_linux_init_abi): Likewise.
+ * ia64-linux-tdep.c (solib-svr4.h): Include.
+ (ia64_linux_init_abi): Register TLS load module fetcher.
+ * m32r-linux-tdep.c (m32r_linux_init_abi): Likewise.
+ * m68klinux-tdep.c (m68k_linux_init_abi): Likewise.
+ * mips-linux-tdep.c (mips_linux_init_abi): Likewise.
+ * s390-tdep.c (s390_gdbarch_init): Likewise.
+ * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
+ * sparc64-linux-tdep.c (solib-svr4.h): Include.
+ (sparc64_linux_init_abi): Register TLS load module fetcher.
+ * Makefile.in (alpha-linux-tdep.o, ia64-linux-tdep.o)
+ (sparc-linux-tdep.o): Update dependencies.
+
2005-03-29 Daniel Jacobowitz <dan@codesourcery.com>
* c-valprint.c (c_value_print): Fix up some formatting. Use
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f8aa73b03a1..2d390af16a3 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1669,7 +1669,7 @@ alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(alpha_tdep_h) \
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(osabi_h) \
$(alpha_tdep_h)
alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdb_assert_h) \
- $(osabi_h) $(alpha_tdep_h)
+ $(osabi_h) $(solib_svr4_h) $(alpha_tdep_h)
alpha-mdebug-tdep.o: alpha-mdebug-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(frame_base_h) $(symtab_h) $(gdbcore_h) \
$(block_h) $(gdb_assert_h) $(alpha_tdep_h) $(mdebugread_h)
@@ -2089,7 +2089,7 @@ ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
$(target_h) $(gdbcore_h) $(regcache_h) $(ia64_tdep_h) $(gdb_wait_h) \
$(gregset_h)
ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \
- $(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h)
+ $(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h) $(solib_svr4_h)
ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(arch_utils_h) $(floatformat_h) $(regcache_h) $(reggroups_h) \
$(frame_h) $(frame_base_h) $(frame_unwind_h) $(doublest_h) \
@@ -2570,7 +2570,7 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $(defs_h) $(frame_h) \
sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(gdbarch_h) $(osabi_h) \
- $(sparc64_tdep_h)
+ $(solib_svr4_h) $(sparc64_tdep_h)
sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 02036ba3a59..86e449816b8 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -22,6 +22,7 @@
#include "frame.h"
#include "gdb_assert.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "alpha-tdep.h"
@@ -140,6 +141,10 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->pc_in_sigtramp = alpha_linux_pc_in_sigtramp;
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 57eadf20b81..fd90d53e1fb 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -218,6 +218,10 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index d4b2899f61e..fe39c213f22 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -495,6 +495,10 @@ arm_linux_init_abi (struct gdbarch_info info,
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 20bb65ca939..347b30db701 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -188,7 +188,8 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
volatile CORE_ADDR addr = 0;
- if (target_get_thread_local_address_p ())
+ if (target_get_thread_local_address_p ()
+ && gdbarch_fetch_tls_load_module_address_p (current_gdbarch))
{
ptid_t ptid = inferior_ptid;
struct objfile *objfile = debaton->objfile;
@@ -196,7 +197,21 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
TRY_CATCH (ex, RETURN_MASK_ALL)
{
- addr = target_get_thread_local_address (ptid, objfile, offset);
+ CORE_ADDR lm_addr;
+
+ /* Fetch the load module address for this objfile. */
+ lm_addr = gdbarch_fetch_tls_load_module_address (current_gdbarch,
+ objfile);
+ /* If it's 0, throw the appropriate exception. */
+ if (lm_addr == 0)
+ {
+ struct exception e
+ = { RETURN_ERROR, TLS_LOAD_MODULE_NOT_FOUND_ERROR, 0 };
+
+ throw_exception (e);
+ }
+
+ 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. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 3612c7123ab..718506c9ec8 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -203,6 +203,7 @@ struct gdbarch
CORE_ADDR decr_pc_after_break;
CORE_ADDR deprecated_function_start_offset;
gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
+ gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
CORE_ADDR frame_args_skip;
gdbarch_unwind_pc_ftype *unwind_pc;
gdbarch_unwind_sp_ftype *unwind_sp;
@@ -329,6 +330,7 @@ struct gdbarch startup_gdbarch =
0, /* decr_pc_after_break */
0, /* deprecated_function_start_offset */
generic_remote_translate_xfer_address, /* remote_translate_xfer_address */
+ 0, /* fetch_tls_load_module_address */
0, /* frame_args_skip */
0, /* unwind_pc */
0, /* unwind_sp */
@@ -583,6 +585,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of decr_pc_after_break, invalid_p == 0 */
/* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
/* Skip verify of remote_translate_xfer_address, invalid_p == 0 */
+ /* Skip verify of fetch_tls_load_module_address, has predicate */
/* Skip verify of frame_args_skip, invalid_p == 0 */
/* Skip verify of unwind_pc, has predicate */
/* Skip verify of unwind_sp, has predicate */
@@ -1090,6 +1093,24 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: fetch_pointer_argument = <0x%lx>\n",
(long) current_gdbarch->fetch_pointer_argument);
+#ifdef FETCH_TLS_LOAD_MODULE_ADDRESS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FETCH_TLS_LOAD_MODULE_ADDRESS_P()",
+ XSTRING (FETCH_TLS_LOAD_MODULE_ADDRESS_P ()));
+#endif
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
+ gdbarch_fetch_tls_load_module_address_p (current_gdbarch));
+#ifdef FETCH_TLS_LOAD_MODULE_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FETCH_TLS_LOAD_MODULE_ADDRESS(objfile)",
+ XSTRING (FETCH_TLS_LOAD_MODULE_ADDRESS (objfile)));
+#endif
+ fprintf_unfiltered (file,
+ "gdbarch_dump: fetch_tls_load_module_address = <0x%lx>\n",
+ (long) current_gdbarch->fetch_tls_load_module_address);
#ifdef TARGET_FLOAT_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_FLOAT_BIT # %s\n",
@@ -3042,6 +3063,30 @@ set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch,
gdbarch->remote_translate_xfer_address = remote_translate_xfer_address;
}
+int
+gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->fetch_tls_load_module_address != NULL;
+}
+
+CORE_ADDR
+gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->fetch_tls_load_module_address != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_tls_load_module_address called\n");
+ return gdbarch->fetch_tls_load_module_address (objfile);
+}
+
+void
+set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
+ gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
+{
+ gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
+}
+
CORE_ADDR
gdbarch_frame_args_skip (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 5952ef12dbd..a46c90c3e5e 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -977,6 +977,33 @@ typedef void (gdbarch_remote_translate_xfer_address_ftype) (struct gdbarch *gdba
extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
extern void set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address);
+/* Fetch the target specific address used to represent a load module. */
+
+#if defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
+/* Legacy for systems yet to multi-arch FETCH_TLS_LOAD_MODULE_ADDRESS */
+#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
+#define FETCH_TLS_LOAD_MODULE_ADDRESS_P() (1)
+#endif
+#endif
+
+extern int gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch);
+#if !defined (GDB_TM_FILE) && defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
+#error "Non multi-arch definition of FETCH_TLS_LOAD_MODULE_ADDRESS"
+#endif
+#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS_P)
+#define FETCH_TLS_LOAD_MODULE_ADDRESS_P() (gdbarch_fetch_tls_load_module_address_p (current_gdbarch))
+#endif
+
+typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (struct objfile *objfile);
+extern CORE_ADDR gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile);
+extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
+#if !defined (GDB_TM_FILE) && defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
+#error "Non multi-arch definition of FETCH_TLS_LOAD_MODULE_ADDRESS"
+#endif
+#if !defined (FETCH_TLS_LOAD_MODULE_ADDRESS)
+#define FETCH_TLS_LOAD_MODULE_ADDRESS(objfile) (gdbarch_fetch_tls_load_module_address (current_gdbarch, objfile))
+#endif
+
extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
#if !defined (GDB_TM_FILE) && defined (FRAME_ARGS_SKIP)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 7b3df2cf03c..12e367b2dd2 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -566,6 +566,9 @@ v:=:CORE_ADDR:decr_pc_after_break:::0:::0
v:=:CORE_ADDR:deprecated_function_start_offset:::0:::0
m::void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len::generic_remote_translate_xfer_address::0
+
+# Fetch the target specific address used to represent a load module.
+F:=:CORE_ADDR:fetch_tls_load_module_address:struct objfile *objfile:objfile
#
v:=:CORE_ADDR:frame_args_skip:::0:::0
M::CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 48cdab957df..7a10aec84d3 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -618,6 +618,10 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
#endif
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 6c349a21211..d68802eee6f 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -437,6 +437,10 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
dwarf2_frame_set_signal_frame_p (gdbarch, i386_linux_dwarf_signal_frame_p);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index b7173cc71ab..2ce3b9a0805 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -25,6 +25,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "osabi.h"
+#include "solib-svr4.h"
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
@@ -124,6 +125,10 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 4c3c093e369..396b2a421f7 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1230,18 +1230,18 @@ thread_db_pid_to_str (ptid_t ptid)
return normal_pid_to_str (ptid);
}
-/* Get the address of the thread local variable in OBJFILE which is
- stored at OFFSET within the thread local storage for thread PTID. */
+/* Get the address of the thread local variable in load module LM which
+ is stored at OFFSET within the thread local storage for thread PTID. */
static CORE_ADDR
-thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
+thread_db_get_thread_local_address (ptid_t ptid,
+ CORE_ADDR lm,
CORE_ADDR offset)
{
if (is_thread (ptid))
{
td_err_e err;
void *address;
- CORE_ADDR lm;
struct thread_info *thread_info;
/* glibc doesn't provide the needed interface. */
@@ -1253,17 +1253,8 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
throw_exception (e);
}
- /* Get the address of the link map for this objfile. */
- lm = svr4_fetch_objfile_link_map (objfile);
-
- /* Whoops, we couldn't find one. Bail out. */
- if (!lm)
- {
- struct exception e
- = { RETURN_ERROR, TLS_LOAD_MODULE_NOT_FOUND_ERROR, 0 };
-
- throw_exception (e);
- }
+ /* Caller should have verified that lm != 0. */
+ gdb_assert (lm != 0);
/* Get info about the thread. */
thread_info = find_thread_pid (ptid);
@@ -1302,7 +1293,7 @@ thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
}
if (target_beneath->to_get_thread_local_address)
- return target_beneath->to_get_thread_local_address (ptid, objfile, offset);
+ return target_beneath->to_get_thread_local_address (ptid, lm, offset);
else
{
struct exception e
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index d60d8fa977f..a4f407f9942 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -419,6 +419,10 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Core file support. */
set_gdbarch_regset_from_core_section
(gdbarch, m32r_linux_regset_from_core_section);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c
index bdff113fac7..b3af23f0476 100644
--- a/gdb/m68klinux-tdep.c
+++ b/gdb/m68klinux-tdep.c
@@ -306,6 +306,10 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 6b621f58383..4750a1f838f 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -1195,6 +1195,10 @@ mips_linux_init_abi (struct gdbarch_info info,
set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver);
set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 53e14625bba..6b6957314a7 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1111,6 +1111,10 @@ ppc_linux_init_abi (struct gdbarch_info info,
tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sighandler_tramp_frame);
}
set_gdbarch_regset_from_core_section (gdbarch, ppc_linux_regset_from_core_section);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
void
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index d2fe35294e6..be427c2cafc 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -3007,6 +3007,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, print_insn_s390);
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
+
return gdbarch;
}
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 4c33e6da588..36c0565e468 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -266,6 +266,10 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
frame_unwind_append_sniffer (gdbarch, sparc32_linux_sigtramp_frame_sniffer);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 7f86e0ae070..45c01939779 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -22,6 +22,7 @@
#include "defs.h"
#include "gdbarch.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "sparc64-tdep.h"
@@ -35,6 +36,10 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* ... but doesn't have kernel-assisted single-stepping support. */
set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/target.h b/gdb/target.h
index ff9ba11400c..1578ddb7b98 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -411,7 +411,7 @@ struct target_ops
thread-local storage hasn't been allocated yet, this function
may return an error. */
CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid,
- struct objfile *objfile,
+ CORE_ADDR load_module_addr,
CORE_ADDR offset);
/* Perform partial transfers on OBJECT. See target_read_partial