This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] dwarf2read.c (load_full_type_unit): Simplify.
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Mon, 9 Jul 2012 18:06:34 -0700 (PDT)
- Subject: [commit] dwarf2read.c (load_full_type_unit): Simplify.
Hi.
This patch simplifies load_full_type_unit.
Hopefully it's the last bit of cleanup before submitting my TU scaling patch.
Regression tested on amd64-linux.
2012-07-09 Doug Evans <dje@google.com>
* dwarf2read.c (load_full_type_unit): Simplify.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.682
diff -u -p -r1.682 dwarf2read.c
--- dwarf2read.c 9 Jul 2012 20:27:53 -0000 1.682
+++ dwarf2read.c 10 Jul 2012 01:02:52 -0000
@@ -15513,27 +15513,18 @@ lookup_signatured_type_at_offset (struct
static void
load_full_type_unit (struct dwarf2_per_cu_data *per_cu)
{
- struct objfile *objfile = per_cu->objfile;
- struct dwarf2_section_info *sect = per_cu->info_or_types_section;
- sect_offset offset = per_cu->offset;
struct signatured_type *sig_type;
- dwarf2_read_section (objfile, sect);
-
- /* We have the section offset, but we need the signature to do the
- hash table lookup. */
- /* FIXME: This is sorta unnecessary, read_signatured_type only uses
- the signature to assert we found the right one.
- Ok, but it's a lot of work. We should simplify things so any needed
- assert doesn't require all this clumsiness. */
- sig_type = lookup_signatured_type_at_offset (objfile, sect, offset);
+ /* We have the per_cu, but we need the signatured_type.
+ Fortunately this is an easy translation. */
+ gdb_assert (per_cu->is_debug_types);
+ sig_type = (struct signatured_type *) per_cu;
- gdb_assert (&sig_type->per_cu == per_cu);
- gdb_assert (sig_type->per_cu.cu == NULL);
+ gdb_assert (per_cu->cu == NULL);
read_signatured_type (sig_type);
- gdb_assert (sig_type->per_cu.cu != NULL);
+ gdb_assert (per_cu->cu != NULL);
}
/* die_reader_func for read_signatured_type.