* 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-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
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)
$(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) \
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) \
#include "frame.h"
#include "gdb_assert.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "alpha-tdep.h"
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
/* 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);
}
\f
/* 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
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;
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. */
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;
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 */
/* 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 */
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",
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)
{
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)
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
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
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. */
#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
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
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. */
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);
}
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
/* 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. */
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
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
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
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;
}
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. */
#include "defs.h"
#include "gdbarch.h"
#include "osabi.h"
+#include "solib-svr4.h"
#include "sparc64-tdep.h"
/* ... 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. */
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