static void psymtab_to_symtab_1 (struct partial_symtab *);
-static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu);
+static void dwarf2_read_abbrevs (struct dwarf2_cu *cu);
static void dwarf2_free_abbrev_table (void *);
struct dwarf2_section_info *section,
unsigned int offset);
-static void read_signatured_type_at_offset (struct objfile *objfile,
- struct dwarf2_section_info *sect,
- unsigned int offset);
+static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu);
static void read_signatured_type (struct signatured_type *type_sig);
load_cu (struct dwarf2_per_cu_data *per_cu)
{
if (per_cu->debug_types_section)
- read_signatured_type_at_offset (per_cu->objfile,
- per_cu->debug_types_section,
- per_cu->offset);
+ load_full_type_unit (per_cu);
else
load_full_comp_unit (per_cu);
return NULL;
}
- dwarf2_read_abbrevs (abfd, &cu);
+ dwarf2_read_abbrevs (&cu);
make_cleanup (dwarf2_free_abbrev_table, &cu);
init_cu_die_reader (&reader_specs, &cu);
cu.list_in_scope = &file_symbols;
/* Read the abbrevs for this compilation unit into a table. */
- dwarf2_read_abbrevs (abfd, &cu);
+ dwarf2_read_abbrevs (&cu);
make_cleanup (dwarf2_free_abbrev_table, &cu);
/* Read the compilation unit die. */
/* Read the abbrevs for this compilation unit into a table. */
gdb_assert (cu->dwarf2_abbrevs == NULL);
- dwarf2_read_abbrevs (abfd, cu);
+ dwarf2_read_abbrevs (cu);
free_abbrevs_cleanup = make_cleanup (dwarf2_free_abbrev_table, cu);
/* Read the compilation unit die. */
cu->header.first_die_offset = info_ptr - beg_of_comp_unit;
/* Read the abbrevs for this compilation unit. */
- dwarf2_read_abbrevs (abfd, cu);
+ dwarf2_read_abbrevs (cu);
free_abbrevs_cleanup = make_cleanup (dwarf2_free_abbrev_table, cu);
/* Link this CU into read_in_chain. */
if (cu->dwarf2_abbrevs == NULL)
{
- dwarf2_read_abbrevs (cu->objfile->obfd, cu);
+ dwarf2_read_abbrevs (cu);
back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
read_abbrevs = 1;
}
the data found in the abbrev table. */
static void
-dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu)
+dwarf2_read_abbrevs (struct dwarf2_cu *cu)
{
+ bfd *abfd = cu->objfile->obfd;
struct comp_unit_head *cu_header = &cu->header;
gdb_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev;
back_to = make_cleanup (null_cleanup, 0);
if (per_cu->cu->dwarf2_abbrevs == NULL)
{
- dwarf2_read_abbrevs (objfile->obfd, per_cu->cu);
+ dwarf2_read_abbrevs (per_cu->cu);
make_cleanup (dwarf2_free_abbrev_table, per_cu->cu);
}
info_ptr = (dwarf2_per_objfile->info.buffer
return type_sig;
}
-/* Read in signatured type at OFFSET and build its CU and die(s). */
+/* Load the DIEs associated with type unit PER_CU into memory. */
static void
-read_signatured_type_at_offset (struct objfile *objfile,
- struct dwarf2_section_info *sect,
- unsigned int offset)
+load_full_type_unit (struct dwarf2_per_cu_data *per_cu)
{
+ struct objfile *objfile = per_cu->objfile;
+ struct dwarf2_section_info *sect = per_cu->debug_types_section;
+ unsigned int offset = per_cu->offset;
struct signatured_type *type_sig;
dwarf2_read_section (objfile, sect);
/* We have the section offset, but we need the signature to do the
- hash table lookup. */
+ 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. */
type_sig = lookup_signatured_type_at_offset (objfile, sect, offset);
gdb_assert (type_sig->per_cu.cu == NULL);
hashtab_obstack_allocate,
dummy_obstack_deallocate);
- dwarf2_read_abbrevs (objfile->obfd, cu);
+ dwarf2_read_abbrevs (cu);
back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
init_cu_die_reader (&reader_specs, cu);