From 460c1c54b4ea43fc33af593431eab18e30395455 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Thu, 20 Oct 2011 23:13:01 +0000 Subject: [PATCH] * dwarf2read.c (dw2_get_file_names): Move adjustment for type section to... (partial_read_comp_unit_head): ...here. Add is_debug_type_section flag. Adjust all callers. (process_psymtab_comp_unit): Remove adjustment for type section. --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2read.c | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 228c456344b..3170446db09 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2011-10-20 Cary Coutant + + * dwarf2read.c (dw2_get_file_names): Move adjustment for type + section to... + (partial_read_comp_unit_head): ...here. Add is_debug_type_section + flag. Adjust all callers. + (process_psymtab_comp_unit): Remove adjustment for type section. + 2011-10-20 Aleksandar Ristovski * cp-namespace.c (cp_scan_for_anonymous_namespaces): Changed function diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 0f9f38220ef..84eb589b42d 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1336,7 +1336,8 @@ 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); static void init_cu_die_reader (struct die_reader_specs *reader, struct dwarf2_cu *cu); @@ -2307,7 +2308,8 @@ dw2_get_file_names (struct objfile *objfile, 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 @@ -2323,8 +2325,6 @@ dw2_get_file_names (struct objfile *objfile, 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); @@ -2971,7 +2971,7 @@ read_comp_unit_head (struct comp_unit_head *cu_header, 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; @@ -2979,6 +2979,11 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *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) @@ -3372,7 +3377,8 @@ process_psymtab_comp_unit (struct objfile *objfile, 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 @@ -3407,8 +3413,6 @@ process_psymtab_comp_unit (struct objfile *objfile, 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); @@ -3670,7 +3674,7 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu, 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 -- 2.30.2