aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-04-01 17:46:44 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-04-01 17:46:44 +0000
commit0cf03b497aedf582a82416b2444acf88bde08de4 (patch)
tree79e471e76ca377623538f1076a38a823c7bdcb06
parent5d901a7357a8f4099aa95a582c8113557c599389 (diff)
downloadgdb-0cf03b497aedf582a82416b2444acf88bde08de4.zip
gdb-0cf03b497aedf582a82416b2444acf88bde08de4.tar.gz
gdb-0cf03b497aedf582a82416b2444acf88bde08de4.tar.bz2
gdb/
* dwarf2read.c (find_slot_in_mapped_hash): New variable back_to, initialize it. Delay HASH initialization. Strip the part after open parenthesis for languages with qualifiers. Call do_cleanups.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c31
2 files changed, 35 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e8607df..954bc2c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-01 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf2read.c (find_slot_in_mapped_hash): New variable back_to,
+ initialize it. Delay HASH initialization. Strip the part after open
+ parenthesis for languages with qualifiers. Call do_cleanups.
+
2011-04-01 Tom Tromey <tromey@redhat.com>
* utils.c (report_command_stats): Don't print `-' for negative
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 3fafe9f..ca6c98b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1989,9 +1989,32 @@ static int
find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
offset_type **vec_out)
{
- offset_type hash = mapped_index_string_hash (name);
+ struct cleanup *back_to = make_cleanup (null_cleanup, 0);
+ offset_type hash;
offset_type slot, step;
+ if (current_language->la_language == language_cplus
+ || current_language->la_language == language_java
+ || current_language->la_language == language_fortran)
+ {
+ /* NAME is already canonical. Drop any qualifiers as .gdb_index does
+ not contain any. */
+ const char *paren = strchr (name, '(');
+
+ if (paren)
+ {
+ char *dup;
+
+ dup = xmalloc (paren - name + 1);
+ memcpy (dup, name, paren - name);
+ dup[paren - name] = 0;
+
+ make_cleanup (xfree, dup);
+ name = dup;
+ }
+ }
+
+ hash = mapped_index_string_hash (name);
slot = hash & (index->symbol_table_slots - 1);
step = ((hash * 17) & (index->symbol_table_slots - 1)) | 1;
@@ -2001,13 +2024,17 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
offset_type i = 2 * slot;
const char *str;
if (index->symbol_table[i] == 0 && index->symbol_table[i + 1] == 0)
- return 0;
+ {
+ do_cleanups (back_to);
+ return 0;
+ }
str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]);
if (!strcmp (name, str))
{
*vec_out = (offset_type *) (index->constant_pool
+ MAYBE_SWAP (index->symbol_table[i + 1]));
+ do_cleanups (back_to);
return 1;
}