summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2004-02-23 16:58:03 +0000
committerDaniel Jacobowitz <drow@false.org>2004-02-23 16:58:03 +0000
commit2d8be32ecd3dccc734dd6c565eb5a6ff53bd844b (patch)
tree7a0d294ff332c3d495ce133e7d65d7ffe60ff3a9
parentc5791484d91843380aebec3fd3efff141fddf8e4 (diff)
downloadbinutils-gdb-2d8be32ecd3dccc734dd6c565eb5a6ff53bd844b.tar.gz
* dwarf2read.c (REF_HASH_SIZE): Move above struct dwarf2_cu.
(struct dwarf2_cu): Add die_ref_table. (die_ref_table): Delete static variable. (store_in_ref_table): Take a comp unit argument and use its die_ref_table. (dwarf2_empty_hash_tables): Likewise. (read_comp_unit): Update call to dwarf2_empty_hash_tables. (read_die_and_children): Update call to store_in_ref_table. (follow_die_ref): Use the comp unit's die_ref_table.
-rw-r--r--gdb/ChangeLog.intercu12
-rw-r--r--gdb/dwarf2read.c43
2 files changed, 34 insertions, 21 deletions
diff --git a/gdb/ChangeLog.intercu b/gdb/ChangeLog.intercu
index 333c5e18d90..76b97d31e9b 100644
--- a/gdb/ChangeLog.intercu
+++ b/gdb/ChangeLog.intercu
@@ -1,5 +1,17 @@
2004-02-23 Daniel Jacobowitz <drow@mvista.com>
+ * dwarf2read.c (REF_HASH_SIZE): Move above struct dwarf2_cu.
+ (struct dwarf2_cu): Add die_ref_table.
+ (die_ref_table): Delete static variable.
+ (store_in_ref_table): Take a comp unit argument and use its
+ die_ref_table.
+ (dwarf2_empty_hash_tables): Likewise.
+ (read_comp_unit): Update call to dwarf2_empty_hash_tables.
+ (read_die_and_children): Update call to store_in_ref_table.
+ (follow_die_ref): Use the comp unit's die_ref_table.
+
+2004-02-23 Daniel Jacobowitz <drow@mvista.com>
+
* dwarf2read.c (read_structure_scope): Don't create a symbol
or call process_die. Return immediately if die->type is set.
Call read_type_die before dwarf2_add_member_fn.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8ffdc83aa6b..975b9a9b9fd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -224,6 +224,11 @@ struct comp_unit_head
int base_known;
};
+/* Fixed size for the DIE hash table. */
+#ifndef REF_HASH_SIZE
+#define REF_HASH_SIZE 1021
+#endif
+
/* Internal state when decoding a particular compilation unit. */
struct dwarf2_cu
{
@@ -281,6 +286,9 @@ struct dwarf2_cu
/* How many compilation units ago was this CU last referenced? */
int last_used;
+
+ /* A hash table of die offsets for following references. */
+ struct die_info *die_ref_table[REF_HASH_SIZE];
};
static const struct objfile_data *dwarf2_cu_tree;
@@ -446,13 +454,6 @@ struct partial_die_info
#define ATTR_ALLOC_CHUNK 4
#endif
-/* A hash table of die offsets for following references. */
-#ifndef REF_HASH_SIZE
-#define REF_HASH_SIZE 1021
-#endif
-
-static struct die_info *die_ref_table[REF_HASH_SIZE];
-
/* Obstack for allocating temporary storage used during symbol reading. */
static struct obstack dwarf2_tmp_obstack;
@@ -947,9 +948,10 @@ static void dump_die (struct die_info *);
static void dump_die_list (struct die_info *);
-static void store_in_ref_table (unsigned int, struct die_info *);
+static void store_in_ref_table (unsigned int, struct die_info *,
+ struct dwarf2_cu *);
-static void dwarf2_empty_hash_tables (void);
+static void dwarf2_empty_hash_tables (struct dwarf2_cu *);
static unsigned int dwarf2_get_ref_die_offset (struct attribute *,
struct dwarf2_cu *);
@@ -4526,7 +4528,7 @@ read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
{
/* Reset die reference table; we are
building new ones now. */
- dwarf2_empty_hash_tables ();
+ dwarf2_empty_hash_tables (cu);
return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL);
}
@@ -4548,7 +4550,7 @@ read_die_and_children (char *info_ptr, bfd *abfd,
int has_children;
cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
- store_in_ref_table (die->offset, die);
+ store_in_ref_table (die->offset, die, cu);
if (has_children)
{
@@ -8044,22 +8046,23 @@ dump_die_list (struct die_info *die)
}
static void
-store_in_ref_table (unsigned int offset, struct die_info *die)
+store_in_ref_table (unsigned int offset, struct die_info *die,
+ struct dwarf2_cu *cu)
{
int h;
struct die_info *old;
h = (offset % REF_HASH_SIZE);
- old = die_ref_table[h];
+ old = cu->die_ref_table[h];
die->next_ref = old;
- die_ref_table[h] = die;
+ cu->die_ref_table[h] = die;
}
static void
-dwarf2_empty_hash_tables (void)
+dwarf2_empty_hash_tables (struct dwarf2_cu *cu)
{
- memset (die_ref_table, 0, sizeof (die_ref_table));
+ memset (cu->die_ref_table, 0, sizeof (cu->die_ref_table));
}
static unsigned int
@@ -8118,16 +8121,14 @@ follow_die_ref (struct attribute *attr, struct dwarf2_cu *cu,
int h;
offset = dwarf2_get_ref_die_offset (attr, cu);
+ *spec_cu = cu;
h = (offset % REF_HASH_SIZE);
- die = die_ref_table[h];
+ die = (*spec_cu)->die_ref_table[h];
while (die)
{
if (die->offset == offset)
- {
- *spec_cu = cu;
- return die;
- }
+ return die;
die = die->next_ref;
}
return NULL;