* [commit] minor cleanups in dwarf2read.c
@ 2012-01-02 0:16 Doug Evans
0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2012-01-02 0:16 UTC (permalink / raw)
To: gdb-patches
Hi.
While hacking on dwarf2read.c I'm still finding some clumsiness
and cleanup that can be done.
Ultimately, I think I may make changes that end up replacing a lot
of this cleanup. However, until then I don't mind cleaning things
up as I go. At least it helps clarify subsequence changes.
This patch is just some comment and formatting tweaks,
separated out.
btw, I didn't update the copyright year on purpose.
We generally update all files en masse, and I didn't
want to interfere with that.
2012-01-01 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf2_per_objfile): Add comment.
(dwarf2_elf_names): Minor reformat.
(dwarf2_per_cu_data): Tweak comment.
(dwarf2_read_section): Fix comment.
(create_all_comp_units): Fix comment.
(load_full_comp_unit): Fix comment.
(process_full_comp_unit): Fix comment.
(read_signatured_type): Fix comment.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.589
diff -u -p -r1.589 dwarf2read.c
--- dwarf2read.c 31 Dec 2011 17:18:13 -0000 1.589
+++ dwarf2read.c 2 Jan 2012 00:02:35 -0000
@@ -181,6 +181,9 @@ struct mapped_index
const char *constant_pool;
};
+/* Collection of data recorded per objfile.
+ This hangs off of dwarf2_objfile_data_key. */
+
struct dwarf2_per_objfile
{
struct dwarf2_section_info info;
@@ -260,7 +263,8 @@ static struct dwarf2_per_objfile *dwarf2
/* Note that if the debugging section has been compressed, it might
have a name like .zdebug_info. */
-static const struct dwarf2_debug_sections dwarf2_elf_names = {
+static const struct dwarf2_debug_sections dwarf2_elf_names =
+{
{ ".debug_info", ".zdebug_info" },
{ ".debug_abbrev", ".zdebug_abbrev" },
{ ".debug_line", ".zdebug_line" },
@@ -426,7 +430,6 @@ struct dwarf2_cu
This test is imperfect as there may exist optimized debug code not using
any location list and still facing inlining issues if handled as
unoptimized code. For a future better test see GCC PR other/32998. */
-
unsigned int has_loclist : 1;
};
@@ -464,7 +467,9 @@ struct dwarf2_per_cu_data
of the CU cache it gets reset to NULL again. */
struct dwarf2_cu *cu;
- /* The corresponding objfile. */
+ /* The corresponding objfile.
+ Normally we can get the objfile from dwarf2_per_objfile.
+ However we can enter this file with just a "per_cu" handle. */
struct objfile *objfile;
/* When using partial symbol tables, the 'psymtab' field is active.
@@ -1579,7 +1584,7 @@ dwarf2_section_empty_p (struct dwarf2_se
return info->asection == NULL || info->size == 0;
}
-/* Read the contents of the section SECTP from object file specified by
+/* Read the contents of the section INFO from object file specified by
OBJFILE, store info about the section into INFO.
If the section is compressed, uncompress it before returning. */
@@ -3767,10 +3772,8 @@ load_partial_comp_unit (struct dwarf2_pe
}
}
-/* Create a list of all compilation units in OBJFILE. We do this only
- if an inter-comp-unit reference is found; presumably if there is one,
- there will be many, and one will occur early in the .debug_info section.
- So there's no point in building this list incrementally. */
+/* Create a list of all compilation units in OBJFILE.
+ This is only done for -readnow and building partial symtabs. */
static void
create_all_comp_units (struct objfile *objfile)
@@ -4581,6 +4584,8 @@ dwarf2_psymtab_to_symtab (struct partial
}
}
}
+\f
+/* Reading in full CUs. */
/* Add PER_CU to the queue. */
@@ -4765,7 +4770,7 @@ load_full_comp_unit (struct dwarf2_per_c
cu->dies = read_comp_unit (info_ptr, cu);
/* We try not to read any attributes in this function, because not
- all objfiles needed for references have been loaded yet, and symbol
+ all CUs needed for references have been loaded yet, and symbol
table processing isn't initialized. But we have to set the CU language,
or we won't be able to build types correctly. */
prepare_one_comp_unit (cu, cu->dies);
@@ -4836,7 +4841,7 @@ compute_delayed_physnames (struct dwarf2
}
}
-/* Generate full symbol information for PST and CU, whose DIEs have
+/* Generate full symbol information for PER_CU, whose DIEs have
already been loaded into memory. */
static void
@@ -5741,6 +5746,7 @@ read_file_scope (struct die_info *die, s
&dwarf2_per_objfile->macinfo, 0);
}
}
+
do_cleanups (back_to);
}
@@ -14447,7 +14453,7 @@ read_signatured_type (struct objfile *ob
NULL /*parent*/);
/* We try not to read any attributes in this function, because not
- all objfiles needed for references have been loaded yet, and symbol
+ all CUs needed for references have been loaded yet, and symbol
table processing isn't initialized. But we have to set the CU language,
or we won't be able to build types correctly. */
prepare_one_comp_unit (cu, cu->dies);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [commit] minor cleanups in dwarf2read.c
@ 2010-08-23 21:52 Doug Evans
0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2010-08-23 21:52 UTC (permalink / raw)
To: gdb-patches
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. */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-02 0:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-02 0:16 [commit] minor cleanups in dwarf2read.c Doug Evans
-- strict thread matches above, loose matches on Subject: below --
2010-08-23 21:52 Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).