aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/thread-db.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver/thread-db.c')
-rw-r--r--gdb/gdbserver/thread-db.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 24531bf..78bc6434 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -266,6 +266,7 @@ found:
process->lwpid = ti_p->ti_lid;
process->thread_known = 1;
+ process->th = *th_p;
err = td_thr_event_enable (th_p, 1);
if (err != TD_OK)
error ("Cannot enable thread event reporting for %d: %s",
@@ -320,6 +321,33 @@ thread_db_look_up_symbols (void)
}
int
+thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
+ CORE_ADDR load_module, CORE_ADDR *address)
+{
+#if HAVE_TD_THR_TLS_GET_ADDR
+ psaddr_t addr;
+ td_err_e err;
+ struct process_info *process;
+
+ process = get_thread_process (thread);
+ if (!process->thread_known)
+ return TD_NOTHR;
+
+ err = td_thr_tls_get_addr (&process->th, (psaddr_t) load_module, offset,
+ &addr);
+ if (err == TD_OK)
+ {
+ *address = (CORE_ADDR) addr;
+ return 0;
+ }
+ else
+ return err;
+#else
+ return -1;
+#endif
+}
+
+int
thread_db_init ()
{
int err;