From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18908 invoked by alias); 25 Mar 2010 19:36:01 -0000 Received: (qmail 18894 invoked by uid 22791); 25 Mar 2010 19:36:00 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.17.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Mar 2010 19:35:55 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.1/8.13.1) with ESMTP id o2PJZqPQ025091 for ; Thu, 25 Mar 2010 19:35:52 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2PJZqOq1400888 for ; Thu, 25 Mar 2010 20:35:52 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o2PJZqdA016099 for ; Thu, 25 Mar 2010 20:35:52 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o2PJZpgI016071; Thu, 25 Mar 2010 20:35:51 +0100 Message-Id: <201003251935.o2PJZpgI016071@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 25 Mar 2010 20:35:51 +0100 Subject: Re: [rfc] Fix some cases of "using" declarations with older G++ versions To: jan.kratochvil@redhat.com (Jan Kratochvil) Date: Thu, 25 Mar 2010 19:36:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20100325181307.GA12511@host0.dyn.jankratochvil.net> from "Jan Kratochvil" at Mar 25, 2010 07:13:07 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00857.txt.bz2 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