From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19759 invoked by alias); 21 Oct 2006 05:13:25 -0000 Received: (qmail 19751 invoked by uid 22791); 21 Oct 2006 05:13:24 -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; Sat, 21 Oct 2006 05:13:20 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1Gb9Ac-00072e-2r; Sat, 21 Oct 2006 01:13:18 -0400 Date: Sat, 21 Oct 2006 05:13:00 -0000 From: Daniel Jacobowitz To: "Munzir Taha (???????? ????)" , gdb@sourceware.org Subject: Re: Why type = ? Message-ID: <20061021051318.GA26818@nevyn.them.org> Mail-Followup-To: "Munzir Taha (???????? ????)" , gdb@sourceware.org References: <200610210620.24201.munzirtaha@gmail.com> <4539992E.626AAE3A@dessent.net> <200610210620.24201.munzirtaha@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4539992E.626AAE3A@dessent.net> <200610210620.24201.munzirtaha@gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00169.txt.bz2 On Sat, Oct 21, 2006 at 06:20:23AM +0300, Munzir Taha (???????? ????) wrote: > (gdb) p n > $2 = 2 > (gdb) whatis errno > type = n is a variable in your program, which you compiled with -g. errno is a variable in the C library, which does not contain debugging information. On Fri, Oct 20, 2006 at 08:51:10PM -0700, Brian Dessent wrote: > "Munzir Taha (???? ??)" wrote: > > > > Hi, in this small program logic tells me that errno and n should have the same > > value displayed in gdb. Am I missing something obvious? > > You're probably running into the fact that on modern glibc errno is a > TLS symbol, not a regular one. This means it can take on a different > value in each thread, and thus is accessed through an indirection. > > You might get better debugging ability if you compile with -ggdb3 > instead of just -g, which gives gdb some additional information. I > believe that without any debug information in the binary, gdb cannot do > anything about TLS symbols, but I'm not sure. See also the proposed > patch > and/or . -g3 will help (because you'll get __errno_location), but other than that this is right for the wrong reasons. You're right that it's a TLS symbol, but that's not why its type is wrong. Anyway, you'll note a revised version of support for TLS symbols without debug info has already been committed, but Jan's changes for TLS symbols in single threaded programs are much thornier. -- Daniel Jacobowitz CodeSourcery