This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] minor cleanups in dwarf2read.c
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Mon, 23 Aug 2010 14:52:14 -0700 (PDT)
- Subject: [commit] minor cleanups in dwarf2read.c
Hi.
I committed this.
2010-08-23 Doug Evans <dje@google.com>
* dwarf2read.c (read_structure_type): Add comment.
(read_enumeration_type): Add comment.
(process_enumeration_scope): Move definition of some locals
closer to their use.
(read_namespace_type): Add comment.
(set_die_type): Fix typo in comment.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.439
retrieving revision 1.441
diff -u -p -r1.439 -r1.441
--- dwarf2read.c 20 Aug 2010 17:16:44 -0000 1.439
+++ dwarf2read.c 23 Aug 2010 21:49:26 -0000 1.441
@@ -6658,6 +6658,9 @@ read_structure_type (struct die_info *di
This is important, for example, because for c++ classes we need
TYPE_NAME set which is only done by new_symbol. Blech. */
type = read_type_die (type_die, type_cu);
+
+ /* TYPE_CU may not be the same as CU.
+ Ensure TYPE is recorded in CU's type_hash table. */
return set_die_type (die, type, cu);
}
@@ -6962,6 +6965,9 @@ read_enumeration_type (struct die_info *
struct die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu);
type = read_type_die (type_die, type_cu);
+
+ /* TYPE_CU may not be the same as CU.
+ Ensure TYPE is recorded in CU's type_hash table. */
return set_die_type (die, type, cu);
}
@@ -7002,21 +7008,21 @@ read_enumeration_type (struct die_info *
static void
process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
{
- struct die_info *child_die;
- struct field *fields;
- struct symbol *sym;
- int num_fields;
- int unsigned_enum = 1;
- char *name;
struct type *this_type;
- num_fields = 0;
- fields = NULL;
this_type = get_die_type (die, cu);
if (this_type == NULL)
this_type = read_enumeration_type (die, cu);
+
if (die->child != NULL)
{
+ struct die_info *child_die;
+ struct symbol *sym;
+ struct field *fields = NULL;
+ int num_fields = 0;
+ int unsigned_enum = 1;
+ char *name;
+
child_die = die->child;
while (child_die && child_die->tag)
{
@@ -7305,6 +7311,9 @@ read_namespace_type (struct die_info *di
ext_die = dwarf2_extension (die, &ext_cu);
type = read_type_die (ext_die, ext_cu);
+
+ /* EXT_CU may not be the same as CU.
+ Ensure TYPE is recorded in CU's type_hash table. */
return set_die_type (die, type, cu);
}
@@ -14178,7 +14187,7 @@ offset_and_type_eq (const void *item_lhs
Therefore caller should follow these rules:
* Try to fetch any prerequisite types we may need to build this DIE type
before building the type and calling set_die_type.
- * After building typer call set_die_type for current DIE as soon as
+ * After building type call set_die_type for current DIE as soon as
possible before fetching more types to complete the current type.
* Make the type as complete as possible before fetching more types. */