* dwarf2read.c (read_and_check_comp_unit_head): Delete unnecessary

prototype.
	(error_check_comp_unit_head): New arg abbrev_section.  All callers
	updated.
	(read_and_check_comp_unit_head): Ditto.
	(read_and_check_type_unit_head): Ditto.
This commit is contained in:
Doug Evans 2012-06-27 00:35:33 +00:00
parent ee0bf529c3
commit 4bdcc0c114
2 changed files with 41 additions and 20 deletions

View File

@ -1,3 +1,12 @@
2012-06-26 Doug Evans <dje@google.com>
* dwarf2read.c (read_and_check_comp_unit_head): Delete unnecessary
prototype.
(error_check_comp_unit_head): New arg abbrev_section. All callers
updated.
(read_and_check_comp_unit_head): Ditto.
(read_and_check_type_unit_head): Ditto.
2012-06-26 Siva Chandra Reddy <sivachandra@google.com> 2012-06-26 Siva Chandra Reddy <sivachandra@google.com>
New attribute 'last' for gdb.Symtab_and_line. New attribute 'last' for gdb.Symtab_and_line.

View File

@ -1462,11 +1462,6 @@ static void find_file_and_directory (struct die_info *die,
static char *file_full_name (int file, struct line_header *lh, static char *file_full_name (int file, struct line_header *lh,
const char *comp_dir); const char *comp_dir);
static gdb_byte *read_and_check_comp_unit_head
(struct comp_unit_head *header,
struct dwarf2_section_info *section, gdb_byte *info_ptr,
int is_debug_types_section);
static void init_cutu_and_read_dies static void init_cutu_and_read_dies
(struct dwarf2_per_cu_data *this_cu, int use_existing_cu, int keep, (struct dwarf2_per_cu_data *this_cu, int use_existing_cu, int keep,
die_reader_func_ftype *die_reader_func, void *data); die_reader_func_ftype *die_reader_func, void *data);
@ -3395,7 +3390,8 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
static void static void
error_check_comp_unit_head (struct comp_unit_head *header, error_check_comp_unit_head (struct comp_unit_head *header,
struct dwarf2_section_info *section) struct dwarf2_section_info *section,
struct dwarf2_section_info *abbrev_section)
{ {
bfd *abfd = section->asection->owner; bfd *abfd = section->asection->owner;
const char *filename = bfd_get_filename (abfd); const char *filename = bfd_get_filename (abfd);
@ -3431,6 +3427,7 @@ error_check_comp_unit_head (struct comp_unit_head *header,
static gdb_byte * static gdb_byte *
read_and_check_comp_unit_head (struct comp_unit_head *header, read_and_check_comp_unit_head (struct comp_unit_head *header,
struct dwarf2_section_info *section, struct dwarf2_section_info *section,
struct dwarf2_section_info *abbrev_section,
gdb_byte *info_ptr, gdb_byte *info_ptr,
int is_debug_types_section) int is_debug_types_section)
{ {
@ -3448,7 +3445,7 @@ read_and_check_comp_unit_head (struct comp_unit_head *header,
header->first_die_offset.cu_off = info_ptr - beg_of_comp_unit; header->first_die_offset.cu_off = info_ptr - beg_of_comp_unit;
error_check_comp_unit_head (header, section); error_check_comp_unit_head (header, section, abbrev_section);
return info_ptr; return info_ptr;
} }
@ -3459,6 +3456,7 @@ read_and_check_comp_unit_head (struct comp_unit_head *header,
static gdb_byte * static gdb_byte *
read_and_check_type_unit_head (struct comp_unit_head *header, read_and_check_type_unit_head (struct comp_unit_head *header,
struct dwarf2_section_info *section, struct dwarf2_section_info *section,
struct dwarf2_section_info *abbrev_section,
gdb_byte *info_ptr, gdb_byte *info_ptr,
ULONGEST *signature, ULONGEST *signature,
cu_offset *type_offset_in_tu) cu_offset *type_offset_in_tu)
@ -3482,7 +3480,7 @@ read_and_check_type_unit_head (struct comp_unit_head *header,
header->first_die_offset.cu_off = info_ptr - beg_of_comp_unit; header->first_die_offset.cu_off = info_ptr - beg_of_comp_unit;
error_check_comp_unit_head (header, section); error_check_comp_unit_head (header, section, abbrev_section);
return info_ptr; return info_ptr;
} }
@ -3603,10 +3601,15 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
htab_t types_htab = NULL; htab_t types_htab = NULL;
int ix; int ix;
struct dwarf2_section_info *section; struct dwarf2_section_info *section;
struct dwarf2_section_info *abbrev_section;
if (VEC_empty (dwarf2_section_info_def, types)) if (VEC_empty (dwarf2_section_info_def, types))
return NULL; return NULL;
abbrev_section = (dwo_file != NULL
? &dwo_file->sections.abbrev
: &dwarf2_per_objfile->abbrev);
for (ix = 0; for (ix = 0;
VEC_iterate (dwarf2_section_info_def, types, ix, section); VEC_iterate (dwarf2_section_info_def, types, ix, section);
++ix) ++ix)
@ -3658,7 +3661,8 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
/* We need to read the type's signature in order to build the hash /* We need to read the type's signature in order to build the hash
table, but we don't need anything else just yet. */ table, but we don't need anything else just yet. */
ptr = read_and_check_type_unit_head (&header, section, ptr, ptr = read_and_check_type_unit_head (&header, section,
abbrev_section, ptr,
&signature, &type_offset_in_tu); &signature, &type_offset_in_tu);
length = header.initial_length_size + header.length; length = header.initial_length_size + header.length;
@ -3870,6 +3874,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
struct attribute *attr; struct attribute *attr;
struct cleanup *cleanups, *free_cu_cleanup = NULL; struct cleanup *cleanups, *free_cu_cleanup = NULL;
struct signatured_type *sig_type = NULL; struct signatured_type *sig_type = NULL;
struct dwarf2_section_info *abbrev_section;
if (use_existing_cu) if (use_existing_cu)
gdb_assert (keep); gdb_assert (keep);
@ -3880,6 +3885,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
dwarf2_read_section (objfile, section); dwarf2_read_section (objfile, section);
begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off; begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off;
abbrev_section = &dwarf2_per_objfile->abbrev;
if (use_existing_cu && this_cu->cu != NULL) if (use_existing_cu && this_cu->cu != NULL)
{ {
@ -3901,8 +3907,8 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
{ {
ULONGEST signature; ULONGEST signature;
info_ptr = read_and_check_type_unit_head (&cu->header, info_ptr = read_and_check_type_unit_head (&cu->header, section,
section, info_ptr, abbrev_section, info_ptr,
&signature, NULL); &signature, NULL);
/* There's no way to get from PER_CU to its containing /* There's no way to get from PER_CU to its containing
@ -3924,8 +3930,9 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
} }
else else
{ {
info_ptr = read_and_check_comp_unit_head (&cu->header, info_ptr = read_and_check_comp_unit_head (&cu->header, section,
section, info_ptr, 0); abbrev_section,
info_ptr, 0);
gdb_assert (this_cu->offset.sect_off == cu->header.offset.sect_off); gdb_assert (this_cu->offset.sect_off == cu->header.offset.sect_off);
gdb_assert (this_cu->length gdb_assert (this_cu->length
@ -3944,7 +3951,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
/* Read the abbrevs for this compilation unit into a table. */ /* Read the abbrevs for this compilation unit into a table. */
if (cu->dwarf2_abbrevs == NULL) if (cu->dwarf2_abbrevs == NULL)
{ {
dwarf2_read_abbrevs (cu, &dwarf2_per_objfile->abbrev); dwarf2_read_abbrevs (cu, abbrev_section);
make_cleanup (dwarf2_free_abbrev_table, cu); make_cleanup (dwarf2_free_abbrev_table, cu);
} }
@ -3964,6 +3971,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
ULONGEST signature; /* Or dwo_id. */ ULONGEST signature; /* Or dwo_id. */
struct attribute *stmt_list, *low_pc, *high_pc, *ranges; struct attribute *stmt_list, *low_pc, *high_pc, *ranges;
int i,num_extra_attrs; int i,num_extra_attrs;
struct dwarf2_section_info *dwo_abbrev_section;
if (has_children) if (has_children)
error (_("Dwarf Error: compilation unit with DW_AT_GNU_dwo_name" error (_("Dwarf Error: compilation unit with DW_AT_GNU_dwo_name"
@ -4035,14 +4043,16 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
cu->dwo_unit = dwo_unit; cu->dwo_unit = dwo_unit;
section = dwo_unit->info_or_types_section; section = dwo_unit->info_or_types_section;
begin_info_ptr = info_ptr = section->buffer + dwo_unit->offset.sect_off; begin_info_ptr = info_ptr = section->buffer + dwo_unit->offset.sect_off;
dwo_abbrev_section = &dwo_unit->dwo_file->sections.abbrev;
init_cu_die_reader (&reader, cu, section, dwo_unit->dwo_file); init_cu_die_reader (&reader, cu, section, dwo_unit->dwo_file);
if (this_cu->is_debug_types) if (this_cu->is_debug_types)
{ {
ULONGEST signature; ULONGEST signature;
info_ptr = read_and_check_type_unit_head (&cu->header, info_ptr = read_and_check_type_unit_head (&cu->header, section,
section, info_ptr, dwo_abbrev_section,
info_ptr,
&signature, NULL); &signature, NULL);
gdb_assert (sig_type->signature == signature); gdb_assert (sig_type->signature == signature);
gdb_assert (dwo_unit->offset.sect_off == cu->header.offset.sect_off); gdb_assert (dwo_unit->offset.sect_off == cu->header.offset.sect_off);
@ -4056,8 +4066,9 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
} }
else else
{ {
info_ptr = read_and_check_comp_unit_head (&cu->header, info_ptr = read_and_check_comp_unit_head (&cu->header, section,
section, info_ptr, 0); dwo_abbrev_section,
info_ptr, 0);
gdb_assert (dwo_unit->offset.sect_off == cu->header.offset.sect_off); gdb_assert (dwo_unit->offset.sect_off == cu->header.offset.sect_off);
gdb_assert (dwo_unit->length gdb_assert (dwo_unit->length
== cu->header.length + cu->header.initial_length_size); == cu->header.length + cu->header.initial_length_size);
@ -4065,7 +4076,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
/* Discard the original CU's abbrev table, and read the DWO's. */ /* Discard the original CU's abbrev table, and read the DWO's. */
dwarf2_free_abbrev_table (cu); dwarf2_free_abbrev_table (cu);
dwarf2_read_abbrevs (cu, &dwo_unit->dwo_file->sections.abbrev); dwarf2_read_abbrevs (cu, dwo_abbrev_section);
/* Read in the die, but leave space to copy over the attributes /* Read in the die, but leave space to copy over the attributes
from the stub. This has the benefit of simplifying the rest of from the stub. This has the benefit of simplifying the rest of
@ -4167,7 +4178,8 @@ init_cutu_and_read_dies_no_follow (struct dwarf2_per_cu_data *this_cu,
cleanups = make_cleanup (free_stack_comp_unit, &cu); cleanups = make_cleanup (free_stack_comp_unit, &cu);
begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off; begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off;
info_ptr = read_and_check_comp_unit_head (&cu.header, section, info_ptr, info_ptr = read_and_check_comp_unit_head (&cu.header, section,
abbrev_section, info_ptr,
this_cu->is_debug_types); this_cu->is_debug_types);
this_cu->length = cu.header.length + cu.header.initial_length_size; this_cu->length = cu.header.length + cu.header.initial_length_size;