This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfa/gdbserver] Updated: Fix crash in thread_db_get_tls_address
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: "Ulrich Weigand" <uweigand at de dot ibm dot com>, drow at false dot org, dje at google dot com
- Date: Fri, 3 Apr 2009 19:26:55 +0100
- Subject: Re: [rfa/gdbserver] Updated: Fix crash in thread_db_get_tls_address
- References: <200904031806.n33I6tjw016918@d12av02.megacenter.de.ibm.com>
On Friday 03 April 2009 19:06:55, Ulrich Weigand wrote:
> Index: src/gdb/gdbserver/thread-db.c
> ===================================================================
> --- src.orig/gdb/gdbserver/thread-db.c
> +++ src/gdb/gdbserver/thread-db.c
> @@ -382,6 +382,10 @@ thread_db_get_tls_address (struct thread
> ? ?struct lwp_info *lwp;
> ? ?struct thread_info *saved_inferior;
> ?
> + ?/* If the thread layer is not (yet) initialized, fail. ?*/
> + ?if (!current_process()->all_symbols_looked_up)
> + ? ?return TD_ERR;
> +
(note the missing space after current_process)
The qGetTLSAddr packet takes an explicit thread id, so in this
case, it may be that the current process isn't the
correct one. I think in this case the best would be to
inferior.c:get_thread_process and use that, like:
if (!get_thread_process (thread)->all_symbols_looked_up)
return TD_ERR;
Alternatively you could make sure you call current_process (),
after temporarily having switched the current inferior, like
we do a bit below.
Sorry for the extra work...
--
Pedro Alves