From b27569303241f8fde83dc9f8ea6ba6193e32a419 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Thu, 31 Mar 2005 19:58:26 +0000 Subject: * 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. --- gdb/gdbarch.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 3612c71..718506c 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) { -- cgit v1.1