/* stabs.c -- Parse stabs debugging information
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
PARAMS ((PTR, struct stab_handle *, const char *, int,
enum debug_type_kind));
static debug_type *stab_demangle_argtypes
- PARAMS ((PTR, struct stab_handle *, const char *, boolean *));
+ PARAMS ((PTR, struct stab_handle *, const char *, boolean *, unsigned int));
/* Save a string in memory. */
boolean is_destructor;
debug_type *args;
boolean varargs;
+ unsigned int physname_len = 0;
/* Constructors are sometimes handled specially. */
is_full_physname_constructor = ((argtypes[0] == '_'
strcpy (physname, fieldname);
}
+ physname_len = strlen (physname);
strcat (physname, buf);
if (tagname != NULL)
strcat (physname, tagname);
false);
}
- args = stab_demangle_argtypes (dhandle, info, *pphysname, &varargs);
+ args = stab_demangle_argtypes (dhandle, info, *pphysname, &varargs, physname_len);
if (args == NULL)
return DEBUG_TYPE_NULL;
static boolean stab_demangle_get_count
PARAMS ((const char **, unsigned int *));
static boolean stab_demangle_prefix
- PARAMS ((struct stab_demangle_info *, const char **));
+ PARAMS ((struct stab_demangle_info *, const char **, unsigned int));
static boolean stab_demangle_function_name
PARAMS ((struct stab_demangle_info *, const char **, const char *));
static boolean stab_demangle_signature
terminated array of argument types. */
static debug_type *
-stab_demangle_argtypes (dhandle, info, physname, pvarargs)
+stab_demangle_argtypes (dhandle, info, physname, pvarargs, physname_len)
PTR dhandle;
struct stab_handle *info;
const char *physname;
boolean *pvarargs;
+ unsigned int physname_len;
{
struct stab_demangle_info minfo;
/* cplus_demangle checks for special GNU mangled forms, but we can't
see any of them in mangled method argument types. */
- if (! stab_demangle_prefix (&minfo, &physname))
+ if (! stab_demangle_prefix (&minfo, &physname, physname_len))
goto error_return;
if (*physname != '\0')
/* Demangle the prefix of the mangled name. */
static boolean
-stab_demangle_prefix (minfo, pp)
+stab_demangle_prefix (minfo, pp, physname_len)
struct stab_demangle_info *minfo;
const char **pp;
+ unsigned int physname_len;
{
const char *scan;
unsigned int i;
/* cplus_demangle checks for global constructors and destructors,
but we can't see them in mangled argument types. */
- /* Look for `__'. */
- scan = *pp;
- do
+ if (physname_len)
+ scan = *pp + physname_len;
+ else
{
- scan = strchr (scan, '_');
- }
- while (scan != NULL && *++scan != '_');
+ /* Look for `__'. */
+ scan = *pp;
+ do
+ scan = strchr (scan, '_');
+ while (scan != NULL && *++scan != '_');
- if (scan == NULL)
- {
- stab_bad_demangle (*pp);
- return false;
- }
+ if (scan == NULL)
+ {
+ stab_bad_demangle (*pp);
+ return false;
+ }
- --scan;
+ --scan;
- /* We found `__'; move ahead to the last contiguous `__' pair. */
- i = strspn (scan, "_");
- if (i > 2)
- scan += i - 2;
+ /* We found `__'; move ahead to the last contiguous `__' pair. */
+ i = strspn (scan, "_");
+ if (i > 2)
+ scan += i - 2;
+ }
if (scan == *pp
&& (ISDIGIT (scan[2])