* dwarf2read.c (dwarf2_read_abbrevs): Delete arg "abfd".

All callers updated.
	(load_full_type_unit): Renamed from read_signatured_type_at_offset.
	Replace all arguments with "per_cu".  All callers updated.
This commit is contained in:
Doug Evans 2012-01-04 19:49:41 +00:00
parent 28dee7f53d
commit e5fe5e75a8
2 changed files with 27 additions and 20 deletions

View File

@ -1,5 +1,10 @@
2012-01-04 Doug Evans <dje@google.com> 2012-01-04 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf2_read_abbrevs): Delete arg "abfd".
All callers updated.
(load_full_type_unit): Renamed from read_signatured_type_at_offset.
Replace all arguments with "per_cu". All callers updated.
* dwarf2read.c (dwarf2_per_cu_data): Remove outdated comment. * dwarf2read.c (dwarf2_per_cu_data): Remove outdated comment.
* dwarf2read.c (init_one_comp_unit): Delete arg "objfile". * dwarf2read.c (init_one_comp_unit): Delete arg "objfile".

View File

@ -924,7 +924,7 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
static void psymtab_to_symtab_1 (struct partial_symtab *); 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 *); static void dwarf2_free_abbrev_table (void *);
@ -1217,9 +1217,7 @@ static struct signatured_type *lookup_signatured_type_at_offset
struct dwarf2_section_info *section, struct dwarf2_section_info *section,
unsigned int offset); unsigned int offset);
static void read_signatured_type_at_offset (struct objfile *objfile, static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu);
struct dwarf2_section_info *sect,
unsigned int offset);
static void read_signatured_type (struct signatured_type *type_sig); static void read_signatured_type (struct signatured_type *type_sig);
@ -1820,9 +1818,7 @@ static void
load_cu (struct dwarf2_per_cu_data *per_cu) load_cu (struct dwarf2_per_cu_data *per_cu)
{ {
if (per_cu->debug_types_section) if (per_cu->debug_types_section)
read_signatured_type_at_offset (per_cu->objfile, load_full_type_unit (per_cu);
per_cu->debug_types_section,
per_cu->offset);
else else
load_full_comp_unit (per_cu); load_full_comp_unit (per_cu);
@ -2300,7 +2296,7 @@ dw2_get_file_names (struct objfile *objfile,
return NULL; return NULL;
} }
dwarf2_read_abbrevs (abfd, &cu); dwarf2_read_abbrevs (&cu);
make_cleanup (dwarf2_free_abbrev_table, &cu); make_cleanup (dwarf2_free_abbrev_table, &cu);
init_cu_die_reader (&reader_specs, &cu); init_cu_die_reader (&reader_specs, &cu);
@ -3437,7 +3433,7 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
cu.list_in_scope = &file_symbols; cu.list_in_scope = &file_symbols;
/* Read the abbrevs for this compilation unit into a table. */ /* 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); make_cleanup (dwarf2_free_abbrev_table, &cu);
/* Read the compilation unit die. */ /* Read the compilation unit die. */
@ -3726,7 +3722,7 @@ load_partial_comp_unit (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. */
gdb_assert (cu->dwarf2_abbrevs == NULL); 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); free_abbrevs_cleanup = make_cleanup (dwarf2_free_abbrev_table, cu);
/* Read the compilation unit die. */ /* Read the compilation unit die. */
@ -4730,7 +4726,7 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
cu->header.first_die_offset = info_ptr - beg_of_comp_unit; cu->header.first_die_offset = info_ptr - beg_of_comp_unit;
/* Read the abbrevs for this compilation 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); free_abbrevs_cleanup = make_cleanup (dwarf2_free_abbrev_table, cu);
/* Link this CU into read_in_chain. */ /* Link this CU into read_in_chain. */
@ -9135,7 +9131,7 @@ read_comp_unit (gdb_byte *info_ptr, struct dwarf2_cu *cu)
if (cu->dwarf2_abbrevs == NULL) 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); back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
read_abbrevs = 1; read_abbrevs = 1;
} }
@ -9314,8 +9310,9 @@ read_full_die (const struct die_reader_specs *reader,
the data found in the abbrev table. */ the data found in the abbrev table. */
static void 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; struct comp_unit_head *cu_header = &cu->header;
gdb_byte *abbrev_ptr; gdb_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev; struct abbrev_info *cur_abbrev;
@ -10004,7 +10001,7 @@ find_partial_die (unsigned int offset, struct dwarf2_cu *cu)
back_to = make_cleanup (null_cleanup, 0); back_to = make_cleanup (null_cleanup, 0);
if (per_cu->cu->dwarf2_abbrevs == NULL) 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); make_cleanup (dwarf2_free_abbrev_table, per_cu->cu);
} }
info_ptr = (dwarf2_per_objfile->info.buffer info_ptr = (dwarf2_per_objfile->info.buffer
@ -14367,19 +14364,24 @@ lookup_signatured_type_at_offset (struct objfile *objfile,
return type_sig; 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 static void
read_signatured_type_at_offset (struct objfile *objfile, load_full_type_unit (struct dwarf2_per_cu_data *per_cu)
struct dwarf2_section_info *sect,
unsigned int offset)
{ {
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; struct signatured_type *type_sig;
dwarf2_read_section (objfile, sect); dwarf2_read_section (objfile, sect);
/* We have the section offset, but we need the signature to do the /* 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); type_sig = lookup_signatured_type_at_offset (objfile, sect, offset);
gdb_assert (type_sig->per_cu.cu == NULL); gdb_assert (type_sig->per_cu.cu == NULL);
@ -14426,7 +14428,7 @@ read_signatured_type (struct signatured_type *type_sig)
hashtab_obstack_allocate, hashtab_obstack_allocate,
dummy_obstack_deallocate); dummy_obstack_deallocate);
dwarf2_read_abbrevs (objfile->obfd, cu); dwarf2_read_abbrevs (cu);
back_to = make_cleanup (dwarf2_free_abbrev_table, cu); back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
init_cu_die_reader (&reader_specs, cu); init_cu_die_reader (&reader_specs, cu);