Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA 2/4] dwarf2_physname
Date: Tue, 02 Feb 2010 23:23:00 -0000	[thread overview]
Message-ID: <4B68B400.3030407@redhat.com> (raw)
In-Reply-To: <20100201221905.GA15584@caradoc.them.org>

On 02/01/2010 02:19 PM, Daniel Jacobowitz wrote:

> What're we trying to answer?  For instance, is it the distinction
> between local variables and global variables?  This is interesting
> because I believe that function-local classes get the enclosing
> function as a prefix, but obviously function-local automatic variables
> should not.

Yes, it was specifically to deal with class static members. Reminder:

namespace
{
   namespace G
   {
     int Gx;
   };
};

gcc will output:
DW_TAG_namespace
-- DW_TAG_namespace
-- DW_AT_name = "G"
---- DW_TAG_variable
---- DW_AT_name = "Gx"

DW_TAG_variable
-- DW_AT_location
-- DW_AT_specification = DW_TAG_variable above

This seems to be correct as far as my interpretation of the DWARF3 spec 
(Dec 20, 2005), Section 4.1 #6 (pg 60).

> I'm not sure how DW_TAG_member comes into this either, that doesn't
> entirely make sense for non-static class members.  Be careful about
> this one: GCC sometimes incorrectly uses DW_TAG_variable, when the
> DWARF standard says they should be DW_TAG_member.

DW_TAG_member does not run through this branch, unless, as you say, gcc 
incorrectly emits DW_TAG_variable instead of DW_TAG_member. I have only 
seen gcc output DW_TAG_variable for member data in two situations: 1) 
static class members (which I think is correct) and 2) const class 
members where the class is not instantiated.

To elaborate on #2:

Consider the following class:

class A
{
public:
  static const int a_constant = 3;
};

int
main (int argc, char* argv[])
{
   return A::a_constant;
}

Gcc will *NOT* output anything about A::a_constant *except* for a 
DW_TAG_variable describing it (DW_AT_name = "a_constant"). No 
DW_AT_specification (as I think there should be). In fact, 
DW_TAG_class_type for A is completely omitted. The only clue that gdb 
gets (either dwarf2_physname or CVS HEAD) is in DW_AT_MIPS_linkage_name. 
This is obviously a gcc bug.

Do you have another example where gcc does this that you'd like me to 
look at?

Or maybe I'm simply not answering your question? [A kind of forest/tree 
thing...]

Keith


  reply	other threads:[~2010-02-02 23:23 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 21:20 Keith Seitz
2009-11-20 22:10 ` Daniel Jacobowitz
2009-11-21  0:04   ` Tom Tromey
2009-11-21  3:46     ` Frank Ch. Eigler
2009-11-23 18:06       ` Tom Tromey
2009-11-23 19:00         ` Daniel Jacobowitz
2009-11-23 16:52   ` Keith Seitz
2009-11-23 17:08     ` Daniel Jacobowitz
2009-11-24 19:20       ` Sami Wagiaalla
2010-01-27 17:10         ` Sami Wagiaalla
2009-12-08 19:47   ` Keith Seitz
2009-12-14 19:33     ` Keith Seitz
2009-12-17 20:19       ` Tom Tromey
2009-12-17 20:28         ` Daniel Jacobowitz
2009-12-17 22:39           ` Paul Pluzhnikov
2009-12-22 18:35           ` Tom Tromey
2009-12-22 19:24             ` Daniel Jacobowitz
2010-01-20 20:37               ` Keith Seitz
2010-01-26 21:17                 ` Daniel Jacobowitz
2010-01-27 19:12                   ` Keith Seitz
2010-01-28 20:22                     ` Keith Seitz
2010-01-28 20:24                       ` Daniel Jacobowitz
2010-01-28 23:41                         ` Keith Seitz
2010-02-01 16:48                           ` Daniel Jacobowitz
2010-02-01 19:32                             ` Keith Seitz
2010-02-01 19:39                               ` Daniel Jacobowitz
2010-02-01 21:52                                 ` Keith Seitz
2010-02-01 22:19                                   ` Daniel Jacobowitz
2010-02-02 23:23                                     ` Keith Seitz [this message]
2010-02-02 23:31                                       ` Keith Seitz
2010-02-03  2:46                                       ` Daniel Jacobowitz
2010-02-04 17:48                                         ` Tom Tromey
2010-02-04 18:14                                           ` Daniel Jacobowitz
2010-02-05 17:13                                             ` Keith Seitz
2010-02-05 17:29                                               ` Daniel Jacobowitz
2010-02-05 20:24                                                 ` Keith Seitz
2010-02-05 20:57                                                   ` Daniel Jacobowitz
2010-02-05 23:10                                                     ` Keith Seitz
2010-02-05 23:46                                                       ` Daniel Jacobowitz
2010-02-04 17:21                             ` Tom Tromey
2010-02-04 17:25                               ` Daniel Jacobowitz
2009-11-23  7:31 ` André Pönitz
2009-11-23 16:57   ` Keith Seitz
2009-11-23 17:20     ` Tom Tromey
2009-11-24  7:22     ` André Pönitz
2009-11-24 22:54       ` Tom Tromey
2009-11-25  9:16         ` André Pönitz
2009-11-25 18:14           ` Tom Tromey
2009-11-23 17:15   ` Tom Tromey
2009-11-24 22:11 ` Joel Brobecker

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=4B68B400.3030407@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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