Correct dict_hash to our most recent version.
Several changes to dict_hash from Adacore's local version were inadvertantly left out of the last change to that function. These changes conservatively cause dict_hash to revert to msymbol_hash_iw in more cases where the symbol being hashed is known not to be Ada-encoded. This avoids a few cases where the function hashes large groups of names with similar prefixes to the same value. Changelog: gdb/ * dictionary.c (dict_hash): Revert to msymbol_hash_iw in more cases.
This commit is contained in:
parent
40658b9446
commit
1d2a4540a5
2 changed files with 22 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2010-10-07 Paul Hilfinger <hilfinger@adacore.com>
|
||||||
|
|
||||||
|
* dictionary.c (dict_hash): Revert to msymbol_hash_iw in
|
||||||
|
more cases.
|
||||||
|
|
||||||
2010-10-07 Paul Hilfinger <hilfinger@adacore.com>
|
2010-10-07 Paul Hilfinger <hilfinger@adacore.com>
|
||||||
|
|
||||||
* ada-lang.c (full_match): Declare.
|
* ada-lang.c (full_match): Declare.
|
||||||
|
|
|
@ -786,7 +786,7 @@ expand_hashtable (struct dictionary *dict)
|
||||||
comparison operators hash to the same value. */
|
comparison operators hash to the same value. */
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
dict_hash (const char *string)
|
dict_hash (const char *string0)
|
||||||
{
|
{
|
||||||
/* The Ada-encoded version of a name P1.P2...Pn has either the form
|
/* The Ada-encoded version of a name P1.P2...Pn has either the form
|
||||||
P1__P2__...Pn<suffix> or _ada_P1__P2__...Pn<suffix> (where the Pi
|
P1__P2__...Pn<suffix> or _ada_P1__P2__...Pn<suffix> (where the Pi
|
||||||
|
@ -796,11 +796,18 @@ dict_hash (const char *string)
|
||||||
does this for a superset of both valid Pi and of <suffix>, but
|
does this for a superset of both valid Pi and of <suffix>, but
|
||||||
in other cases it simply returns msymbol_hash_iw(STRING0). */
|
in other cases it simply returns msymbol_hash_iw(STRING0). */
|
||||||
|
|
||||||
|
const char *string;
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (*string == '_' && strncmp (string, "_ada_", 5) == 0)
|
string = string0;
|
||||||
string += 5;
|
if (*string == '_')
|
||||||
|
{
|
||||||
|
if (strncmp (string, "_ada_", 5) == 0)
|
||||||
|
string += 5;
|
||||||
|
else
|
||||||
|
return msymbol_hash_iw (string0);
|
||||||
|
}
|
||||||
|
|
||||||
hash = 0;
|
hash = 0;
|
||||||
while (*string)
|
while (*string)
|
||||||
|
@ -810,13 +817,15 @@ dict_hash (const char *string)
|
||||||
case '$':
|
case '$':
|
||||||
case '.':
|
case '.':
|
||||||
case 'X':
|
case 'X':
|
||||||
case '(':
|
if (string0 == string)
|
||||||
return hash;
|
return msymbol_hash_iw (string0);
|
||||||
|
else
|
||||||
|
return hash;
|
||||||
case ' ':
|
case ' ':
|
||||||
string += 1;
|
case '(':
|
||||||
break;
|
return msymbol_hash_iw (string0);
|
||||||
case '_':
|
case '_':
|
||||||
if (string[1] == '_')
|
if (string[1] == '_' && string != string0)
|
||||||
{
|
{
|
||||||
if (((c = string[2]) < 'a' || c > 'z') && c != 'O')
|
if (((c = string[2]) < 'a' || c > 'z') && c != 'O')
|
||||||
return hash;
|
return hash;
|
||||||
|
|
Loading…
Reference in a new issue