diff options
author | Tom Tromey <tromey@redhat.com> | 2014-06-25 10:16:55 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-07-07 09:06:14 -0600 |
commit | f0f9ff9530992cb86c7022310af223b2721117d1 (patch) | |
tree | 8ce203cef87c35218567961b74b6f755f901e25c /gdb/target.c | |
parent | 3bb9e7b43fb3bef0ecfef14b9185661afbe5f4c5 (diff) | |
download | gdb-f0f9ff9530992cb86c7022310af223b2721117d1.zip gdb-f0f9ff9530992cb86c7022310af223b2721117d1.tar.gz gdb-f0f9ff9530992cb86c7022310af223b2721117d1.tar.bz2 |
convert to_get_thread_local_address to use target delegation
This converts to_get_thread_local_address to use
TARGET_DEFAULT_NORETURN. One possible oddity is that this changes the
text of the kind of exception thrown in some cases. This doesn't seem
to be a problem; in fact perhaps the final call to 'error' in
target_translate_tls_address should be changed to call
generic_tls_error.
2014-07-07 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_get_thread_local_address>: Use
TARGET_DEFAULT_NORETURN.
* target.c (generic_tls_error): New function.
(target_translate_tls_address): Don't search target stack.
* target-delegates.c: Rebuild.
* ppc-linux-tdep.c (ppc_linux_spe_context): Don't search target
stack.
* linux-thread-db.c (thread_db_get_thread_local_address):
Unconditionally call beneath target.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gdb/target.c b/gdb/target.c index ece59e6..91756c8 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -49,6 +49,8 @@ static void target_info (char *, int); +static void generic_tls_error (void) ATTRIBUTE_NORETURN; + static void default_terminal_info (struct target_ops *, const char *, int); static int default_watchpoint_addr_within_range (struct target_ops *, @@ -732,24 +734,24 @@ target_is_pushed (struct target_ops *t) return 0; } +/* Default implementation of to_get_thread_local_address. */ + +static void +generic_tls_error (void) +{ + throw_error (TLS_GENERIC_ERROR, + _("Cannot find thread-local variables on this target")); +} + /* Using the objfile specified in OBJFILE, find the address for the current thread's thread-local storage with offset OFFSET. */ CORE_ADDR target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) { volatile CORE_ADDR addr = 0; - struct target_ops *target; - - for (target = current_target.beneath; - target != NULL; - target = target->beneath) - { - if (target->to_get_thread_local_address != NULL) - break; - } + struct target_ops *target = ¤t_target; - if (target != NULL - && gdbarch_fetch_tls_load_module_address_p (target_gdbarch ())) + if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ())) { ptid_t ptid = inferior_ptid; volatile struct gdb_exception ex; |