Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: FYI: fix PR 9708
Date: Sat, 13 Mar 2010 02:36:00 -0000	[thread overview]
Message-ID: <20100313023630.GA29285@caradoc.them.org> (raw)
In-Reply-To: <m3r5np83vi.fsf@fleche.redhat.com>

On Fri, Mar 12, 2010 at 05:25:05PM -0700, Tom Tromey wrote:
> +      attr = dwarf2_attr (die, DW_AT_external, cu);
> +      if (attr == NULL && die->parent->tag != DW_TAG_namespace)
> +	return 0;
> +      /* A variable in a lexical block of some kind does not need a
> +	 namespace, even though in C++ such variables may be external
> +	 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;

Why is this:

int f()
{
  static int x;
  ...
}

Different from this:

int f()
{
  if (foo)
    {
      static int x;
      ...
    }
}

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

> +
> +  long method ()
> +  {
> +    static bool svar = true;
> +    return key2;
> +  }

Looking at your test case, I guess the answer is that you're relying on
GCC's extra DW_TAG_lexical_block emitted for all C++ functions; this
is not a DWARF requirement and other compilers omit it.

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

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2010-03-13  2:36 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 [this message]
2010-03-15 20:00   ` Tom Tromey
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=20100313023630.GA29285@caradoc.them.org \
    --to=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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