From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23381 invoked by alias); 25 Aug 2006 13:48:01 -0000 Received: (qmail 23363 invoked by uid 22791); 25 Aug 2006 13:48:00 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Fri, 25 Aug 2006 13:47:52 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GGc2I-0001ah-2f; Fri, 25 Aug 2006 09:47:50 -0400 Date: Sat, 26 Aug 2006 11:56:00 -0000 From: Daniel Jacobowitz To: Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: RFC: Ignore TLS symbols for non-TLS programs Message-ID: <20060825134750.GA5857@nevyn.them.org> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org References: <20060825021311.GB30225@host0.dyn.jankratochvil.net> <20060825034301.GA24479@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060825034301.GA24479@nevyn.them.org> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00193.txt.bz2 On Thu, Aug 24, 2006 at 11:43:01PM -0400, Daniel Jacobowitz wrote: > On Fri, Aug 25, 2006 at 04:13:11AM +0200, Jan Kratochvil wrote: > > * with -ggdb2 and less "errno" in fact does not exist anywhere as it was > > compiled to "(*__errno_location ())" and the macro definition is not present. > > Unfortunately gdb will find the TLS symbol and it will try to access it but > > as the program has been compiled without -lpthread the TLS base register > > (%gs on i386) is not setup and it will result in: > > Cannot access memory at address 0x8 > > That can't be correct. Every program using glibc references errno. > If the program can access it, then GDB ought to be able to also. > In this case, libc.so.6 exports a dynamic TLS symbol named errno. > > Did you try this with the patch you posted earlier to access TLS > without debug info? Oh, I see now - that's not enough, you'd also need to implement direct DTV lookup in GDB since libthread_db probably can't cope. And that might require some fiddling with e.g. the remote protocol, too, to get at the result of ps_get_thread_area. Anyway, this is doable, just a bit of work. With your other patch, I hope this would get a more appropriate error, like "can't access thread local data"? -- Daniel Jacobowitz CodeSourcery