This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: c++/1023: setting a breakpoint on C++ member functions
- From: David Carlton <carlton at math dot stanford dot edu>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 3 Mar 2003 19:18:00 -0000
- Subject: Re: c++/1023: setting a breakpoint on C++ member functions
- Reply-to: David Carlton <carlton at math dot stanford dot edu>
The following reply was made to PR c++/1023; it has been noted by GNATS.
From: David Carlton <carlton at math dot stanford dot edu>
To: GNATS Filer <gdb-gnats at sources dot redhat dot com>
Cc: Michael Elizabeth Chastain <mec at shout dot net>,
Daniel Jacobowitz <drow at mvista dot com>
Subject: Re: c++/1023: setting a breakpoint on C++ member functions
Date: 03 Mar 2003 11:14:00 -0800
I tried the following patch as a sort of "proof of concept" of my
solution (I certainly wouldn't consider it appropriate as-is even if
it worked, for various reasons):
2003-02-28 David Carlton <carlton at math dot stanford dot edu>
* stabsread.c (read_member_functions): Check that physnames really
look like they can be demangled.
Index: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.57
diff -u -p -r1.57 stabsread.c
--- stabsread.c 25 Feb 2003 21:36:19 -0000 1.57
+++ stabsread.c 1 Mar 2003 00:51:33 -0000
@@ -3098,15 +3098,29 @@ read_member_functions (struct field_info
p++;
}
- /* If this is just a stub, then we don't have the real name here. */
-
if (TYPE_STUB (new_sublist->fn_field.type))
{
if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type))
TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type;
- new_sublist->fn_field.is_stub = 1;
}
new_sublist->fn_field.physname = savestring (*pp, p - *pp);
+ {
+ char *demangled_name
+ = cplus_demangle (new_sublist->fn_field.physname,
+ DMGL_PARAMS | DMGL_ANSI);
+
+ if (demangled_name == NULL)
+ {
+ /* Claim that it's a stub so that other code doesn't
+ trust the physname. Note that the above TYPE_STUB
+ test isn't reliable: see PR c++/1023. */
+ new_sublist->fn_field.is_stub = 1;
+ }
+ else
+ {
+ xfree (demangled_name);
+ }
+ }
*pp = p + 1;
/* Set this member function's visibility fields. */
The good news is that, when doing a test suite run with GCC 2.96,
stabs, it did fix gdb.c++/pr-1023.exp; the bad news is that a lot of
stuff in gdb.c++/userdef.exp started failing.
So clearly there's something going on here that I don't understand
(not surprisingly, given how little I know about stabs; certainly
having the type and the fn_field disagree about whether or not
something is a stub sounds like a bad idea to me). I'm going to stop
working on this one for now, because I'm too busy to become an expert
on stabsread.c.