From fd5008162e2dc522e4fea16de38a355f7e1a43be Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sat, 16 Oct 2004 17:42:00 +0000 Subject: * linux-i386-low.c (ps_get_thread_area): New. * linux-x86-64-low.c (ps_get_thread_area): New. * linux-low.c: Include . (linux_kill_one_process): Don't kill the first thread here. (linux_kill): Kill the first thread here. (kill_lwp): New function. (send_sigstop, linux_send_signal): Use it. * proc-service.c: Clean up #ifdefs. (fpregset_info): Delete. (ps_lgetregs): Update and enable implementation. (ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Remove disabled implementations. * remote-utils.c (struct sym_cache, symbol_cache): New. (input_interrupt): Print a clearer message. (async_io_enabled): New variable. (enable_async_io, disable_async_io): Use it. Update comments. (look_up_one_symbol): Use the symbol cache. * thread-db.c (thread_db_look_up_symbols): New function. (thread_db_init): Update comments. Call thread_db_look_up_symbols. --- gdb/gdbserver/thread-db.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gdb/gdbserver/thread-db.c') diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index f3d57a5..c6e0c2d 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -312,11 +312,36 @@ thread_db_find_new_threads (void) error ("Cannot find new threads: %s", thread_db_err_str (err)); } +/* Cache all future symbols that thread_db might request. We can not + request symbols at arbitrary states in the remote protocol, only + when the client tells us that new symbols are available. So when + we load the thread library, make sure to check the entire list. */ + +static void +thread_db_look_up_symbols (void) +{ + const char **sym_list = td_symbol_list (); + CORE_ADDR unused; + + for (sym_list = td_symbol_list (); *sym_list; sym_list++) + look_up_one_symbol (*sym_list, &unused); +} + int thread_db_init () { int err; + /* FIXME drow/2004-10-16: This is the "overall process ID", which + GNU/Linux calls tgid, "thread group ID". When we support + attaching to threads, the original thread may not be the correct + thread. We would have to get the process ID from /proc for NPTL. + For LinuxThreads we could do something similar: follow the chain + of parent processes until we find the highest one we're attached + to, and use its tgid. + + This isn't the only place in gdbserver that assumes that the first + process in the list is the thread group leader. */ proc_handle.pid = ((struct inferior_list_entry *)current_inferior)->id; err = td_ta_new (&proc_handle, &thread_agent); @@ -332,6 +357,7 @@ thread_db_init () if (thread_db_enable_reporting () == 0) return 0; thread_db_find_new_threads (); + thread_db_look_up_symbols (); return 1; default: -- cgit v1.1