diff options
author | Nick Clifton <nickc@redhat.com> | 2002-08-16 11:44:03 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2002-08-16 11:44:03 +0000 |
commit | 4b73ca9289d20e97f4764c65575bccc80175636e (patch) | |
tree | 062fd0c5b7f1da402cd95de578d62e3663db3821 | |
parent | 2ec3c90a77bffcb6a1577ba19425a1f76a3b3f37 (diff) | |
download | gdb-4b73ca9289d20e97f4764c65575bccc80175636e.zip gdb-4b73ca9289d20e97f4764c65575bccc80175636e.tar.gz gdb-4b73ca9289d20e97f4764c65575bccc80175636e.tar.bz2 |
Cope with demangling function names that include a double underscore.
-rw-r--r-- | binutils/ChangeLog | 10 | ||||
-rw-r--r-- | binutils/stabs.c | 53 |
2 files changed, 40 insertions, 23 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index de9c571..9b0a306 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,13 @@ +2002-08-16 Sivaguru Sankaridurg <siva@eternal-systems.com> + + * stabs.c (parse_stab_argtype): Pass length of physname to + stab_demangle_argtypes. + (stab_demangle_argtypes): Add new parameter - length of physname. + Pass length of physname on to stab_demangle_prefix. + (stab_demangle_prefix): Add new parameter - length of physname. + Use length of physname (if supplied) to compute end of function + name. + 2002-08-15 Alan Modra <amodra@bigpond.net.au> * readelf.c: Include elf/i370.h. diff --git a/binutils/stabs.c b/binutils/stabs.c index 0873582..d3efdf1 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -1,5 +1,5 @@ /* 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>. @@ -213,7 +213,7 @@ static debug_type stab_find_tagged_type 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. */ @@ -2908,6 +2908,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname, boolean is_destructor; debug_type *args; boolean varargs; + unsigned int physname_len = 0; /* Constructors are sometimes handled specially. */ is_full_physname_constructor = ((argtypes[0] == '_' @@ -2984,6 +2985,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname, strcpy (physname, fieldname); } + physname_len = strlen (physname); strcat (physname, buf); if (tagname != NULL) strcat (physname, tagname); @@ -3000,7 +3002,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, 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; @@ -3729,7 +3731,7 @@ static unsigned int stab_demangle_count PARAMS ((const char **)); 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 @@ -3821,11 +3823,12 @@ stab_demangle_get_count (pp, pi) 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; @@ -3842,7 +3845,7 @@ stab_demangle_argtypes (dhandle, info, physname, pvarargs) /* 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') @@ -3869,9 +3872,10 @@ stab_demangle_argtypes (dhandle, info, physname, pvarargs) /* 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; @@ -3879,26 +3883,29 @@ stab_demangle_prefix (minfo, pp) /* 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]) |