This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa/gdbserver] Updated: Fix crash in thread_db_get_tls_address


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]