Article View: gnu.gdb.bug
Article #156Demangler broken for templates
From: Dave Daney
Date: Mon, 03 Aug 1992 04:25
Date: Mon, 03 Aug 1992 04:25
141 lines
3877 bytes
3877 bytes
Here is the problem: gdb-4.6 does not seem to demangle template methods.
This patch fixes the problems that I could find.
My system is Interactive UNIX 2.2.1 (SysV/386 R3.2) with gcc-2.2.2, but it
looks like this is needed for all configurations.
*** cplus-dem.c Tue Jul 14 02:34:20 1992
--- ../../gdb-4.6.dave/gdb/cplus-dem.c Mon Aug 3 08:56:11 1992
***************
*** 488,493 ****
--- 488,494 ----
case 't':
/* Template */
success = demangle_template (declp, mangled, work);
+ func_done = 1; /* demangle_template should finish every thing */
break;
case '_':
***************
*** 597,604 ****
--- 598,613 ----
const char *old_p;
int symbol_len;
string temp;
+ #ifndef LONGERNAMES
+ const char *premangle;
+ #endif
(*mangled)++;
+
+ #ifndef LONGERNAMES
+ premangle = *mangled;
+ #endif
+
string_init (&tname);
string_init (&trawname);
/* get template name */
***************
*** 766,771 ****
--- 775,781 ----
{
string_append (&tname, trawname.b);
}
+ string_appendn (&tname, "", 1); /* final form of tname */
string_delete(&trawname);
if (!success)
***************
*** 785,790 ****
--- 795,803 ----
}
else
{
+ #ifndef LONGERNAMES
+ remember_type (premangle, *mangled - premangle, work);
+ #endif
success = demangle_args (declp, mangled, work);
}
}
***************
*** 915,927 ****
success = 0;
}
}
! else if ((scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 'Q')))
{
! /* A GNU style constructor starts with "__<digit>" or "__Q". */
work -> constructor = 1;
*mangled = scan + 2;
}
! else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't'))
{
/* Mangled name starts with "__". Skip over any leading '_' characters,
then find the next "__" that separates the prefix from the signature.
--- 928,942 ----
success = 0;
}
}
! else if ((scan == *mangled) && (isdigit (scan[2])
! || (scan[2] == 'Q')
! || (scan[2] == 't')))
{
! /* A GNU style constructor starts with "__<digit>" or "__Q" or "__t". */
work -> constructor = 1;
*mangled = scan + 2;
}
! else if ((scan == *mangled) && !isdigit (scan[2]))
{
/* Mangled name starts with "__". Skip over any leading '_' characters,
then find the next "__" that separates the prefix from the signature.
***************
*** 1108,1115 ****
}
else
{
! *count = **type - '0';
! (*type)++;
if (isdigit (**type))
{
p = *type;
--- 1123,1129 ----
}
else
{
! *count = 0;
if (isdigit (**type))
{
p = *type;
***************
*** 1121,1131 ****
p++;
}
while (isdigit (*p));
! if (*p == '_')
! {
*type = p + 1;
! *count = n;
}
}
}
return (1);
--- 1135,1149 ----
p++;
}
while (isdigit (*p));
! if (*p == '_') /* I hope this should be done for n < 10 */
! { /* if not Dave Daney broke it. */
*type = p + 1;
! }
! else
! {
! *type = p;
}
+ *count = n;
}
}
return (1);
Dave Daney daney@mermaid.micro.umn.edu
Technical Details
Message-ID:
<199208031425.AA28960@mermaid.micro.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mermaid.micro.umn.edu!daneyShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mermaid.micro.umn.edu!daney From: daney@mermaid.micro.umn.edu (Dave Daney) Subject: Demangler broken for templates Message-ID: <199208031425.AA28960@mermaid.micro.umn.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 3 Aug 1992 04:25:30 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 142