From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19885 invoked by alias); 2 Mar 2005 18:32:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18493 invoked from network); 2 Mar 2005 18:30:52 -0000 Received: from unknown (HELO e33.co.us.ibm.com) (32.97.110.131) by sourceware.org with SMTP; 2 Mar 2005 18:30:52 -0000 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e33.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j22IUp0D640944 for ; Wed, 2 Mar 2005 13:30:51 -0500 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j22IUpdB125036 for ; Wed, 2 Mar 2005 11:30:51 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j22IUpO3027809 for ; Wed, 2 Mar 2005 11:30:51 -0700 Received: from austin.ibm.com (netmail2.austin.ibm.com [9.41.248.176]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j22IUon3027779; Wed, 2 Mar 2005 11:30:50 -0700 Received: from lazy.austin.ibm.com (lazy.austin.ibm.com [9.53.94.97]) by austin.ibm.com (8.12.10/8.12.10) with ESMTP id j22IUoRZ164444; Wed, 2 Mar 2005 12:30:50 -0600 Date: Wed, 02 Mar 2005 18:32:00 -0000 From: Manoj Iyer X-X-Sender: manjo@lazy To: gdb-patches@sources.redhat.com cc: Elena Zannoni Subject: Re: [RFC] Dont skip DW_TAG_member in load_partial_dies() In-Reply-To: <20050215232018.GB8631@nevyn.them.org> Message-ID: References: <20050215232018.GB8631@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-03/txt/msg00018.txt.bz2 Elena, Any comments on this patch of mine? ok to commit? Thanks ----- manjo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Cogito ergo sum + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ On Tue, 15 Feb 2005, Daniel Jacobowitz wrote: > On Tue, Feb 15, 2005 at 03:06:57PM -0600, Manoj Iyer wrote: > > > > GDB prints internal error with C++ application produced by XLC. > > Many of the tests in the GDB testsuite already will probably produce > this error, if you want to try running the testsuite with xlC. It > probably won't be easy, though. > > I'm copying this to Elena, since she is the maintainer of the DWARF-2 > reader. Your patch looks right to me. In fact, I've been working on > running the GDB testsuite using ARM's compiler today, and I have a > patch that looks exactly like this in my working directory :-) > > > When the above testcase is compiled -m64 by XLC, GDB generates an internal > > error: > > > > "internal-error: could not find partial DIE in cache" > > > > GCC creates a DWARF TAG for "a" as DW_TAG_variable and XLC creates > > DW_TAG_member. GDB throws away TAGS that it find as uninteresting. In this > > case DW_TAG_member. (this is in dwarf2read.c function: > > load_partial_dies(). ) > > > > GCC created DWARF information > > ------------------------------- > > <2><102>: Abbrev Number: 13 (DW_TAG_variable) > > DW_AT_name : a > > DW_AT_decl_file : 1 > > DW_AT_decl_line : 13 > > DW_AT_MIPS_linkage_name: _ZN1XIiE1aE > > DW_AT_type : > > DW_AT_external : 1 > > DW_AT_declaration : 1 > > > > XLC created DWARF information > > ------------------------------ > > <2><96>: Abbrev Number: 5 (DW_TAG_member) > > DW_AT_name : a > > DW_AT_accessibility: 1 (public) > > DW_AT_declaration : 1 > > DW_AT_type : <78> > > > > > > GCC in this case is producing wrong information. According to DWARF > > spec: > > > > " If the variable entry represents the defining declaration for a C++ > > static data member of a structure, class or union, the entry has a > > DW_AT_specification attribute, whose value is a reference to the debugging > > information entry representing the declaration of this data member. The > > referenced entry has the tag DW_TAG_member and will be a child of some > > class, structure or union type entry. " > > > > So I think GDB needs to handle the DW_TAG_member and not skip it, when > > dealing with C++. > > > > Here is a patch to GDB that will fix this problem > > > > ================ Patch to gdb ================== > > 2005-02-15 Manoj Iyer > > > > * dwarf2read.c (load_partial_dies): Save DIE with tag > > DW_TAG_member, generated by XLC when compiling C++ application. > > > > diff -Naur ./old/src/gdb/dwarf2read.c ./new/src/gdb/dwarf2read.c > > --- ./old/src/gdb/dwarf2read.c 2005-02-15 11:13:05.000000000 -0600 > > +++ ./new/src/gdb/dwarf2read.c 2005-02-22 10:24:08.000000000 -0600 > > @@ -5167,7 +5167,8 @@ > > && abbrev->tag != DW_TAG_enumerator > > && abbrev->tag != DW_TAG_subprogram > > && abbrev->tag != DW_TAG_variable > > - && abbrev->tag != DW_TAG_namespace) > > + && abbrev->tag != DW_TAG_namespace > > + && abbrev->tag != DW_TAG_member) > > { > > /* Otherwise we skip to the next sibling, if any. */ > > info_ptr = skip_one_die (info_ptr + bytes_read, abbrev, cu); > > > > ========================= END PATCH ====================== > > > > > > ok to commit? > > > > Thanks > > ----- > > manjo > > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > + Cogito ergo sum + > > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > -- > Daniel Jacobowitz > CodeSourcery, LLC >