Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com, libstdc++@gcc.gnu.org
Subject: [RFA/stabs reader] Fix v3 duplicate constructors problem
Date: Mon, 03 Dec 2001 12:48:00 -0000	[thread overview]
Message-ID: <20011203154836.A28821@nevyn.them.org> (raw)

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  <drow@mvista.com>

	* 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));


             reply	other threads:[~2001-12-03 20:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-03 12:48 Daniel Jacobowitz [this message]
2001-12-03 13:22 ` Daniel Berlin
2001-12-03 13:25   ` Daniel Jacobowitz
2001-12-03 13:28     ` Daniel Berlin
2001-12-03 13:52 ` Jason Merrill
2001-12-03 14:29   ` Daniel Jacobowitz
2001-12-03 14:58     ` Jason Merrill
2001-12-03 15:25       ` Michael Snyder
2001-12-04  8:25         ` Jason Merrill
2001-12-04  8:53           ` Jim Blandy
2001-12-04  9:43             ` Joe Buck
2001-12-07 15:25 ` Jim Blandy
2001-12-07 15:30   ` Daniel Jacobowitz
2001-12-04  1:09 Michael Elizabeth Chastain
2001-12-04  5:27 ` Jason Merrill
2001-12-04  7:40   ` Daniel Berlin
2001-12-04  8:58   ` Daniel Jacobowitz

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=20011203154836.A28821@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /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