* inferiors.c (get_thread_process): Make global.
authorUlrich Weigand <uweigand@de.ibm.com>
Fri, 3 Apr 2009 20:15:51 +0000 (20:15 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Fri, 3 Apr 2009 20:15:51 +0000 (20:15 +0000)
* 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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/inferiors.c
gdb/gdbserver/server.h
gdb/gdbserver/thread-db.c

index d7c129a699f24a674093708402636dc1f8dccfba..a5c0bd8264987b2a7fb149626c46a5eb74a23d11 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-03  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * 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.
+
 2009-04-03  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * remote-utils.c (prepare_resume_reply): Null-terminate packet.
index 2d26b6ab4f4182483cc3e76470193ef4d330cd1b..f96438ef5368726e02d13157d3fb1826c45b9747 100644 (file)
@@ -442,7 +442,7 @@ find_process_pid (int pid)
     find_inferior_id (&all_processes, pid_to_ptid (pid));
 }
 
-static struct process_info *
+struct process_info *
 get_thread_process (struct thread_info *thread)
 {
   int pid = ptid_get_pid (thread->entry.id);
index 1af5313396a3abfbf83447dafdd4c3956c296e80..7a0b77054c21d98aa5297b93117e85c890c07356 100644 (file)
@@ -201,6 +201,7 @@ struct process_info
    no current thread selected.  */
 
 struct process_info *current_process (void);
+struct process_info *get_thread_process (struct thread_info *);
 
 #include "regcache.h"
 #include "gdb/signals.h"
index 936bb0f942b04e711900bcf4b960334d3e961a6a..4a26be951b26333b191020b7da44874940f99a55 100644 (file)
@@ -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);
This page took 0.049701 seconds and 4 git commands to generate.