From: brobecke Date: Fri, 4 Jan 2008 21:36:25 +0000 (+0000) Subject: * ada-lang.c (is_name_suffix): Handle middle-name numeric suffixes X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=89dee6d6ba92262d2568e8b5855c0d5b042c4543;p=pf3gnuchains%2Fsourceware.git * ada-lang.c (is_name_suffix): Handle middle-name numeric suffixes that are used to differentiate homonyms. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 699a553e26..acdbc1e79a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-01-04 Joel Brobecker + + * ada-lang.c (is_name_suffix): Handle middle-name numeric suffixes + that are used to differentiate homonyms. + 2008-01-04 Jerome Guitton * ada-lang.c (decode_packed_array_type): Avoid a seg fault diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 198ef62c72..6e3e6a30da 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4934,12 +4934,14 @@ ada_lookup_symbol_nonlocal (const char *name, names (e.g., XVE) are not included here. Currently, the possible suffixes are given by either of the regular expression: - (__[0-9]+)?[.$][0-9]+ [nested subprogram suffix, on platforms such - as GNU/Linux] - ___[0-9]+ [nested subprogram suffix, on platforms such as HP/UX] - _E[0-9]+[bs]$ [protected object entry suffixes] + [.$][0-9]+ [nested subprogram suffix, on platforms such as GNU/Linux] + ___[0-9]+ [nested subprogram suffix, on platforms such as HP/UX] + _E[0-9]+[bs]$ [protected object entry suffixes] (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(JM|LJM|X([FDBUP].*|R[^T]?)))?$ - */ + + Also, any leading "__[0-9]+" sequence is skipped before the suffix + match is performed. This sequence is used to differentiate homonyms, + is an optional part of a valid name suffix. */ static int is_name_suffix (const char *str) @@ -4948,20 +4950,20 @@ is_name_suffix (const char *str) const char *matching; const int len = strlen (str); - /* (__[0-9]+)?\.[0-9]+ */ - matching = str; + /* Skip optional leading __[0-9]+. */ + if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit (str[2])) { - matching += 3; - while (isdigit (matching[0])) - matching += 1; - if (matching[0] == '\0') - return 1; + str += 3; + while (isdigit (str[0])) + str += 1; } + + /* [.$][0-9]+ */ - if (matching[0] == '.' || matching[0] == '$') + if (str[0] == '.' || str[0] == '$') { - matching += 1; + matching = str + 1; while (isdigit (matching[0])) matching += 1; if (matching[0] == '\0') @@ -4969,6 +4971,7 @@ is_name_suffix (const char *str) } /* ___[0-9]+ */ + if (len > 3 && str[0] == '_' && str[1] == '_' && str[2] == '_') { matching = str + 3; @@ -5021,8 +5024,10 @@ is_name_suffix (const char *str) str += 1; } } + if (str[0] == '\000') return 1; + if (str[0] == '_') { if (str[1] != '_' || str[2] == '\000')