From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1463 invoked by alias); 3 Dec 2001 20:48:14 -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 1283 invoked from network); 3 Dec 2001 20:48:06 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 3 Dec 2001 20:48:06 -0000 Received: from drow by nevyn.them.org with local (Exim 3.33 #1 (Debian)) id 16B00y-0008Bt-00; Mon, 03 Dec 2001 15:48:36 -0500 Date: Mon, 03 Dec 2001 12:48:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com, libstdc++@gcc.gnu.org Subject: [RFA/stabs reader] Fix v3 duplicate constructors problem Message-ID: <20011203154836.A28821@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, libstdc++@gcc.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23i X-SW-Source: 2001-12/txt/msg00058.txt.bz2 I tracked down the annoying duplication of constructors using G++ 3.0 with stabs. The problem is that all the clones of the constructor are emitted, so there really are two of them. The obvious thing to do to fix this in GCC (and I'd like it fixed in GCC) would seem to be checking DECL_ABSTRACT_ORIGIN like the Dwarf frontend does instead of DECL_ABSTRACT. That works for eliminating the duplicates and creating the names we need, but the mangled name in debug info is the "*INTERNAL*" version if we do that. I'd like to emit the name of the constructor and the mangled name of the complete object constructor, ideally. C++ people, does that sound right? Or feasible? Unlike the vtable fixes, though, I can fix this in GDB too. I'm planning to do both, since GCCs with this issue have been circulating for a long time. I'm still running tests on this, but it looks pretty good so far. OK to commit when they're done? In addition, it nicely gets us: XPASS: gdb.base/constvars.exp: ptype lecherous XPASS: gdb.base/constvars.exp: ptype lectern -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2001-12-03 Daniel Jacobowitz * stabsread.c (read_member_functions): Skip member functions which are duplicates of the callable constructor/destructor. Index: stabsread.c =================================================================== RCS file: /cvs/src/src/gdb/stabsread.c,v retrieving revision 1.16 diff -u -p -r1.16 stabsread.c --- stabsread.c 2001/09/24 17:16:53 1.16 +++ stabsread.c 2001/12/03 20:40:11 @@ -2953,6 +2953,7 @@ read_member_functions (struct field_info { int nfn_fields = 0; int length = 0; + int skip_method; /* Total number of member functions defined in this class. If the class defines two `f' functions, and one `g' function, then this will have the value 3. */ @@ -2991,6 +2992,36 @@ read_member_functions (struct field_info sublist = NULL; look_ahead_type = NULL; length = 0; + + skip_method = 0; + if (p - *pp == strlen ("__base_ctor") + && strncmp (*pp, "__base_ctor", strlen ("__base_ctor")) == 0) + skip_method = 1; + else if (p - *pp == strlen ("__base_dtor") + && strncmp (*pp, "__base_dtor", strlen ("__base_dtor")) == 0) + skip_method = 1; + else if (p - *pp == strlen ("__deleting_dtor") + && strncmp (*pp, "__deleting_dtor", + strlen ("__deleting_dtor")) == 0) + skip_method = 1; + + if (skip_method) + { + /* Skip past '::'. */ + *pp = p + 2; + /* Read the type. */ + read_type (pp, objfile); + /* Skip past the colon, mangled name, semicolon, flags, and final + semicolon. */ + while (**pp != ';') + (*pp) ++; + (*pp) ++; + while (**pp != ';') + (*pp) ++; + (*pp) ++; + + continue; + } new_fnlist = (struct next_fnfieldlist *) xmalloc (sizeof (struct next_fnfieldlist));