From: Paul Hilfinger <Hilfinger@adacore.com>, ":"@gnat.com
To: gdb-patches@sourceware.org
Subject: [commit] Correct dict_hash to our most recent version.
Date: Thu, 07 Oct 2010 08:44:00 -0000 [thread overview]
Message-ID: <20101007084404.9100B561BD@kwai.gnat.com> (raw)
In-Reply-To: <m3ocb70w8m.fsf@fleche.redhat.com> (message from Tom Tromey on Wed, 06 Oct 2010 16:52:57 -0600)
Sigh. I must stop working late at night. I have corrected my last
checkin of dictionary.c:dict_hash to include the code that the
comments in my commit message was actually discussing (deferring to
msymbol_hash_iw in a few more cases to avoid some nasty hash
collisions). While I should ask for another round of approval
technically, for expendience I'm going to go out on a limb and check
this in now, since it passes the testsuite, isn't likely to provoke
a violent reaction, given that my first version didn't, and is easily
undone in any case.
Paul Hilfinger
Changelog:
gdb/
* dictionary.c (dict_hash): Revert to msymbol_hash_iw in
more cases.
---
gdb/ChangeLog | 5 +++++
gdb/dictionary.c | 25 +++++++++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index f3ac306..4f18e8c 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -786,7 +786,7 @@ expand_hashtable (struct dictionary *dict)
comparison operators hash to the same value. */
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
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
in other cases it simply returns msymbol_hash_iw(STRING0). */
+ const char *string;
unsigned int hash;
int c;
- if (*string == '_' && strncmp (string, "_ada_", 5) == 0)
- string += 5;
+ string = string0;
+ if (*string == '_')
+ {
+ if (strncmp (string, "_ada_", 5) == 0)
+ string += 5;
+ else
+ return msymbol_hash_iw (string0);
+ }
hash = 0;
while (*string)
@@ -810,13 +817,15 @@ dict_hash (const char *string)
case '$':
case '.':
case 'X':
- case '(':
- return hash;
+ if (string0 == string)
+ return msymbol_hash_iw (string0);
+ else
+ return hash;
case ' ':
- string += 1;
- break;
+ case '(':
+ return msymbol_hash_iw (string0);
case '_':
- if (string[1] == '_')
+ if (string[1] == '_' && string != string0)
{
if (((c = string[2]) < 'a' || c > 'z') && c != 'O')
return hash;
--
1.7.0.4
--
Paul N. Hilfinger
(Hilfinger@adacore.com)
next prev parent reply other threads:[~2010-10-07 8:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 8:20 [RFA] Extend hashed symbol dictionaries to work with Ada Paul Hilfinger
2010-10-06 22:43 ` Tom Tromey
2010-10-06 22:53 ` Tom Tromey
2010-10-07 3:31 ` Paul Hilfinger
2010-10-07 7:17 ` [commit] " Paul Hilfinger
2010-10-07 8:44 ` Paul Hilfinger, : [this message]
2010-10-08 22:59 ` [commit] Correct dict_hash to our most recent version Tom Tromey
2010-10-07 3:29 ` [RFA] Extend hashed symbol dictionaries to work with Ada Paul Hilfinger
2010-10-06 23:18 ` Joel Brobecker
2010-10-06 23:59 ` Doug Evans
2010-10-07 6:29 ` Paul Hilfinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101007084404.9100B561BD@kwai.gnat.com \
--to=hilfinger@adacore.com \
--cc=":"@gnat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox