aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/thread-db.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-04-03 20:15:51 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-04-03 20:15:51 +0000
commit7fe519cb2170cf7fb9d5d27d181b430c8c9e4f94 (patch)
tree755f7a419fb6721a3bc331dd11f41f7dcbd0e32d /gdb/gdbserver/thread-db.c
parent409c383c98cc54cf0e1db3dbdb851d7e13e9c52a (diff)
downloadgdb-7fe519cb2170cf7fb9d5d27d181b430c8c9e4f94.zip
gdb-7fe519cb2170cf7fb9d5d27d181b430c8c9e4f94.tar.gz
gdb-7fe519cb2170cf7fb9d5d27d181b430c8c9e4f94.tar.bz2
* inferiors.c (get_thread_process): Make global.
* server.h (get_thread_process): Add prototype. * thread-db.c (find_one_thread): Use get_thread_process instead of current_process. (thread_db_get_tls_address): Do not crash if called when thread layer is not yet initialized.
Diffstat (limited to 'gdb/gdbserver/thread-db.c')
-rw-r--r--gdb/gdbserver/thread-db.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 936bb0f..4a26be9 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -233,7 +233,7 @@ find_one_thread (ptid_t ptid)
td_err_e err;
struct thread_info *inferior;
struct lwp_info *lwp;
- struct process_info_private *proc = current_process()->private;
+ struct process_info_private *proc;
int lwpid = ptid_get_lwp (ptid);
inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid);
@@ -242,6 +242,7 @@ find_one_thread (ptid_t ptid)
return 1;
/* Get information about this thread. */
+ proc = get_thread_process (inferior)->private;
err = td_ta_map_lwp2thr (proc->thread_agent, lwpid, &th);
if (err != TD_OK)
error ("Cannot get thread handle for LWP %d: %s",
@@ -382,6 +383,10 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
struct lwp_info *lwp;
struct thread_info *saved_inferior;
+ /* If the thread layer is not (yet) initialized, fail. */
+ if (!get_thread_process (thread)->all_symbols_looked_up)
+ return TD_ERR;
+
lwp = get_thread_lwp (thread);
if (!lwp->thread_known)
find_one_thread (lwp->head.id);