Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: FYI: fix PR 9708
Date: Mon, 15 Mar 2010 20:00:00 -0000	[thread overview]
Message-ID: <m3ocipe4ok.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20100313023630.GA29285@caradoc.them.org> (Daniel Jacobowitz's 	message of "Fri, 12 Mar 2010 21:36:34 -0500")

>>>>> "Daniel" == Daniel Jacobowitz <dan@codesourcery.com> writes:

[...]
Daniel> Now one of those is going to get a namespace and the other isn't.
Daniel> I'd have thought we would call them both f()::x - although clearly
Daniel> that's not sufficient to uniquely identify them.  Should they
Daniel> both be ! die_needs_namespace?

Yes, I think we should also omit DW_TAG_subprogram here.  I just didn't
think of it.  I can either just check it in, or if you have an easy way
to test it, let me know.  I've appended the patch.

Calling them f()::x might be interesting, but there are some caveats.

First, I am not sure the rest of gdb (I'm thinking the parser at least)
is set up to handle this.  AFAIK this would be a new feature.

Second, we'd probably have to insert two symbols here -- one for the
global name and one for the local name.  There are cases where gcc has
to give the static a synthetic linkage name, e.g.:

struct K {
  int m () {
    static bool themagicstatic = false;
    int x;
    {
      static bool themagicstatic = false;
      x = themagicstatic ? 23 : 24;
    }
    return x + themagicstatic ? 23 : 24;
  }
}

This leads to:

opsy. nm pr | grep themagicstatic
080497de V _ZZN1K1mEvE14themagicstatic
080497dd V _ZZN1K1mEvE14themagicstatic_0

.. so in the inner scope, we still need a symbol named "themagicstatic";
calling it "themagicstatic_0" would be confusing to the user.

Daniel> I'm sure I originally fixed some bug by giving these things the
Daniel> physname of 'x'... but probably, whatever it was is also fixed by your
Daniel> change to use list_in_scope.

Yeah, the die_needs_namespace change is needed to get the proper name
for the symbol in new_symbol.  Otherwise it ends up like
"K::themagicstatic", which is wrong.

Tom

*** dwarf2read.c.~1.366.~	2010-03-12 17:20:15.000000000 -0700
--- dwarf2read.c	2010-03-15 13:47:54.000000000 -0600
***************
*** 3241,3247 ****
  	 and have a mangled name.  */
        if (die->parent->tag ==  DW_TAG_lexical_block
  	  || die->parent->tag ==  DW_TAG_try_block
! 	  || die->parent->tag ==  DW_TAG_catch_block)
  	return 0;
        return 1;
  
--- 3241,3248 ----
  	 and have a mangled name.  */
        if (die->parent->tag ==  DW_TAG_lexical_block
  	  || die->parent->tag ==  DW_TAG_try_block
! 	  || die->parent->tag ==  DW_TAG_catch_block
! 	  || die->parent->tag == DW_TAG_subprogram)
  	return 0;
        return 1;
  


  reply	other threads:[~2010-03-15 20:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-13  0:25 Tom Tromey
2010-03-13  2:36 ` Daniel Jacobowitz
2010-03-15 20:00   ` Tom Tromey [this message]
2010-03-15 20:11     ` Daniel Jacobowitz
2010-03-15 20:25       ` Tom Tromey

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=m3ocipe4ok.fsf@fleche.redhat.com \
    --to=tromey@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