Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: jan.kratochvil@redhat.com (Jan Kratochvil)
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Fix some cases of "using" declarations with older G++  versions
Date: Thu, 25 Mar 2010 19:36:00 -0000	[thread overview]
Message-ID: <201003251935.o2PJZpgI016071@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20100325181307.GA12511@host0.dyn.jankratochvil.net> from "Jan Kratochvil" at Mar 25, 2010 07:13:07 PM

Jan Kratochvil wrote:

> On Thu, 25 Mar 2010 17:27:00 +0100, Ulrich Weigand wrote:
> > @@ -3940,6 +3940,30 @@ read_func_scope (struct die_info *die, s
> >  
> >    inherit_abstract_dies (die, cu);
> >  
> > +  /* If we have a DW_AT_specification, we might need to import using
> > +     directives from the context of the specification DIE.  See the
> > +     comment in determine_prefix.  */
> > +  if (cu->language == language_cplus)
> > +    {
> > +      struct dwarf2_cu *spec_cu = cu;
> > +      struct die_info *spec_die = die_specification (die, &spec_cu);
> 
> This may also fetch DW_AT_abstract_origin which has been already imported by
> inherit_abstract_dies.  But duplicate DW_TAG_imported_module should not hurt.

Hmmm, good point.  I've added a check that we actually have a 
DW_AT_specification here.

> > +	{
> > +	  child_die = spec_die->child;
> > +	  while (child_die && child_die->tag)
> > +	    {
> > +	      if (child_die->tag == DW_TAG_imported_module)
> > +		process_die (child_die, cu);
>                                         spec_cu probably?

Indeed.

Updated patch is below.  Retested on powerpc64-linux.

Thanks,
Ulrich


ChangeLog:

	* dwarf2read.c (read_func_scope): Also scan specification DIEs
	for DW_TAG_imported_module children.


Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.372
diff -u -p -r1.372 dwarf2read.c
--- gdb/dwarf2read.c	22 Mar 2010 13:21:39 -0000	1.372
+++ gdb/dwarf2read.c	25 Mar 2010 18:47:59 -0000
@@ -3940,6 +3940,31 @@ read_func_scope (struct die_info *die, s
 
   inherit_abstract_dies (die, cu);
 
+  /* If we have a DW_AT_specification, we might need to import using
+     directives from the context of the specification DIE.  See the
+     comment in determine_prefix.  */
+  if (cu->language == language_cplus
+      && dwarf2_attr (die, DW_AT_specification, cu))
+    {
+      struct dwarf2_cu *spec_cu = cu;
+      struct die_info *spec_die = die_specification (die, &spec_cu);
+
+      while (spec_die)
+	{
+	  child_die = spec_die->child;
+	  while (child_die && child_die->tag)
+	    {
+	      if (child_die->tag == DW_TAG_imported_module)
+		process_die (child_die, spec_cu);
+	      child_die = sibling_die (child_die);
+	    }
+
+	  /* In some cases, GCC generates specification DIEs that
+	     themselves contain DW_AT_specification attributes.  */
+	  spec_die = die_specification (spec_die, &spec_cu);
+	}
+    }
+
   new = pop_context ();
   /* Make a block for the local symbols within.  */
   block = finish_block (new->name, &local_symbols, new->old_blocks,


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2010-03-25 19:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 16:27 Ulrich Weigand
2010-03-25 18:13 ` Jan Kratochvil
2010-03-25 19:36   ` Ulrich Weigand [this message]
2010-03-26 14:18     ` Daniel Jacobowitz
2010-03-26 18:57       ` Ulrich Weigand

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=201003251935.o2PJZpgI016071@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@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