* stabs.c (parse_stab_type): Fix handling of template names with

template parameters containing `::'.
	(stab_demangle_type): Handle a qualified name in a pointer to
	member.
This commit is contained in:
Ian Lance Taylor 1999-07-08 00:49:04 +00:00
parent c2a1d49a27
commit c602a1658f
2 changed files with 53 additions and 25 deletions

View file

@ -1,3 +1,10 @@
1999-07-08 Ian Lance Taylor <ian@zembu.com>
* stabs.c (parse_stab_type): Fix handling of template names with
template parameters containing `::'.
(stab_demangle_type): Handle a qualified name in a pointer to
member.
1999-06-23 Ian Lance Taylor <ian@zembu.com> 1999-06-23 Ian Lance Taylor <ian@zembu.com>
* Makefile.am (dlltool_SOURCES): Add dyn-string.c. * Makefile.am (dlltool_SOURCES): Add dyn-string.c.

View file

@ -1,5 +1,5 @@
/* stabs.c -- Parse stabs debugging information /* stabs.c -- Parse stabs debugging information
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>. Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -1316,14 +1316,21 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
bad_stab (orig); bad_stab (orig);
return DEBUG_TYPE_NULL; return DEBUG_TYPE_NULL;
} }
while (q1 != NULL && p > q1 && p[1] == ':') if (q1 != NULL && p > q1 && p[1] == ':')
{ {
q2 = strchr (q1, '>'); int nest = 0;
if (q2 == NULL || q2 < p)
for (q2 = q1; *q2 != '\0'; ++q2)
{
if (*q2 == '<')
++nest;
else if (*q2 == '>')
--nest;
else if (*q2 == ':' && nest == 0)
break; break;
p += 2; }
p = strchr (p, ':'); p = q2;
if (p == NULL) if (*p != ':')
{ {
bad_stab (orig); bad_stab (orig);
return DEBUG_TYPE_NULL; return DEBUG_TYPE_NULL;
@ -4785,6 +4792,7 @@ stab_demangle_type (minfo, pp, ptype)
case 'O': case 'O':
{ {
boolean memberp, constp, volatilep; boolean memberp, constp, volatilep;
debug_type class_type = DEBUG_TYPE_NULL;
debug_type *args; debug_type *args;
boolean varargs; boolean varargs;
unsigned int n; unsigned int n;
@ -4797,11 +4805,8 @@ stab_demangle_type (minfo, pp, ptype)
varargs = false; varargs = false;
++*pp; ++*pp;
if (! isdigit ((unsigned char) **pp)) if (isdigit ((unsigned char) **pp))
{ {
stab_bad_demangle (orig);
return false;
}
n = stab_demangle_count (pp); n = stab_demangle_count (pp);
if (strlen (*pp) < n) if (strlen (*pp) < n)
{ {
@ -4811,6 +4816,30 @@ stab_demangle_type (minfo, pp, ptype)
name = *pp; name = *pp;
*pp += n; *pp += n;
if (ptype != NULL)
{
class_type = stab_find_tagged_type (minfo->dhandle,
minfo->info,
name, (int) n,
DEBUG_KIND_CLASS);
if (class_type == DEBUG_TYPE_NULL)
return false;
}
}
else if (**pp == 'Q')
{
if (! stab_demangle_qualified (minfo, pp,
(ptype == NULL
? (debug_type *) NULL
: &class_type)))
return false;
}
else
{
stab_bad_demangle (orig);
return false;
}
if (memberp) if (memberp)
{ {
if (**pp == 'C') if (**pp == 'C')
@ -4851,14 +4880,6 @@ stab_demangle_type (minfo, pp, ptype)
if (ptype != NULL) if (ptype != NULL)
{ {
debug_type class_type;
class_type = stab_find_tagged_type (minfo->dhandle, minfo->info,
name, (int) n,
DEBUG_KIND_CLASS);
if (class_type == DEBUG_TYPE_NULL)
return false;
if (! memberp) if (! memberp)
*ptype = debug_make_offset_type (minfo->dhandle, class_type, *ptype = debug_make_offset_type (minfo->dhandle, class_type,
*ptype); *ptype);