gdb_byte *info_ptr,
gdb_byte *buffer,
unsigned int buffer_size,
- bfd *abfd);
+ bfd *abfd,
+ int is_debug_type_section);
static void init_cu_die_reader (struct die_reader_specs *reader,
struct dwarf2_cu *cu);
info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
buffer, buffer_size,
- abfd);
+ abfd,
+ this_cu->debug_type_section != NULL);
/* Skip dummy compilation units. */
if (info_ptr >= buffer + buffer_size
dwarf2_read_abbrevs (abfd, &cu);
make_cleanup (dwarf2_free_abbrev_table, &cu);
- if (this_cu->debug_type_section)
- info_ptr += 8 /*signature*/ + cu.header.offset_size;
init_cu_die_reader (&reader_specs, &cu);
read_full_die (&reader_specs, &comp_unit_die, info_ptr,
&has_children);
static gdb_byte *
partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
gdb_byte *buffer, unsigned int buffer_size,
- bfd *abfd)
+ bfd *abfd, int is_debug_type_section)
{
gdb_byte *beg_of_comp_unit = info_ptr;
info_ptr = read_comp_unit_head (header, info_ptr, abfd);
+ /* If we're reading a type unit, skip over the signature and
+ type_offset fields. */
+ if (is_debug_type_section)
+ info_ptr += 8 /*signature*/ + header->offset_size;
+
header->first_die_offset = info_ptr - beg_of_comp_unit;
if (header->version != 2 && header->version != 3 && header->version != 4)
info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
buffer, buffer_size,
- abfd);
+ abfd,
+ this_cu->debug_type_section != NULL);
/* Skip dummy compilation units. */
if (info_ptr >= buffer + buffer_size
make_cleanup (dwarf2_free_abbrev_table, &cu);
/* Read the compilation unit die. */
- if (this_cu->debug_type_section)
- info_ptr += 8 /*signature*/ + cu.header.offset_size;
init_cu_die_reader (&reader_specs, &cu);
info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr,
&has_children);
info_ptr = partial_read_comp_unit_head (&cu->header, info_ptr,
dwarf2_per_objfile->info.buffer,
dwarf2_per_objfile->info.size,
- abfd);
+ abfd, 0);
/* Skip dummy compilation units. */
if (info_ptr >= (dwarf2_per_objfile->info.buffer