Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: "Munzir Taha (???????? ????)" <munzirtaha@gmail.com>,
		gdb@sourceware.org
Subject: Re: Why type = <data variable, no debug info>?
Date: Sat, 21 Oct 2006 05:13:00 -0000	[thread overview]
Message-ID: <20061021051318.GA26818@nevyn.them.org> (raw)
In-Reply-To: <4539992E.626AAE3A@dessent.net> <200610210620.24201.munzirtaha@gmail.com>

On Sat, Oct 21, 2006 at 06:20:23AM +0300, Munzir Taha (???????? ????) wrote:
> (gdb) p n
> $2 = 2
> (gdb) whatis errno
> type = <data variable, no debug info>

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 <http://sourceware.org/ml/gdb-patches/2006-08/threads.html#00187>
> and/or <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337>.

-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


      parent reply	other threads:[~2006-10-21  5:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-21  3:20 Munzir Taha (منذر طه)
2006-10-21  3:51 ` Brian Dessent
2006-10-21  4:44   ` Munzir Taha (منذر طه)
2006-10-21  5:13   ` Daniel Jacobowitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061021051318.GA26818@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.org \
    --cc=munzirtaha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox