From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7316 invoked by alias); 3 Apr 2009 18:26:49 -0000 Received: (qmail 7292 invoked by uid 22791); 3 Apr 2009 18:26:46 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Apr 2009 18:26:41 +0000 Received: (qmail 31602 invoked from network); 3 Apr 2009 18:26:38 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Apr 2009 18:26:38 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [rfa/gdbserver] Updated: Fix crash in thread_db_get_tls_address Date: Fri, 03 Apr 2009 18:26:00 -0000 User-Agent: KMail/1.9.10 Cc: "Ulrich Weigand" , drow@false.org, dje@google.com References: <200904031806.n33I6tjw016918@d12av02.megacenter.de.ibm.com> In-Reply-To: <200904031806.n33I6tjw016918@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904031926.56114.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00078.txt.bz2 On Friday 03 April 2009 19:06:55, Ulrich Weigand wrote: > Index: src/gdb/gdbserver/thread-db.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/thread-db.c > +++ src/gdb/gdbserver/thread-db.c > @@ -382,6 +382,10 @@ thread_db_get_tls_address (struct thread > =A0 =A0struct lwp_info *lwp; > =A0 =A0struct thread_info *saved_inferior; > =A0 > + =A0/* If the thread layer is not (yet) initialized, fail. =A0*/ > + =A0if (!current_process()->all_symbols_looked_up) > + =A0 =A0return 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... --=20 Pedro Alves