Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile

The next patch aims to remove the dwarf2_per_objfile global.  In many
functions, we need to find a way to get a reference to the current
dwarf2_per_objfile through the objects passed in parameters.  Often, we have
access to a dwarf2_cu or a dwarf2_per_cu_data.  These objects have a reference
to the objfile, through which we can get the dwarf2_per_objfile:

  dwarf2_per_objfile = ((struct dwarf2_per_objfile *)
		        objfile_data (objfile, dwarf2_objfile_data_key));

However, this is a bit cumbersome to do all over the place.  It would be
more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to
their dwarf2_per_objfile, which would then have a reference to the
objfile.  It would be more in line with the object hierarchy, where
dwarf2_per_objfile owns the dwarf2_per_cu_data instances.  We could
even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we
can access dwarf2_per_objfile through dwarf2_cu::per_cu.

In a graphical way, references would look like this after the current
patch:

  objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data
                                    |      ^
				    |      |
                                    `- dwarf2_cu

This patch has been tested on the buildbot.

gdb/ChangeLog:

	* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
	<dwarf2_per_objfile>: New field.
	(struct dwarf2_per_cu_data) <objfile>: Remove.
	<dwarf2_per_objfile>: New field.
	(create_cu_from_index_list): Assign dwarf2_per_objfile instead
	of objfile.
	(create_signatured_type_table_from_index): Likewise.
	(create_debug_type_hash_table): Likewise.
	(fill_in_sig_entry_from_dwo_entry): Likewise.
	(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
	(create_type_unit_group): Assign dwarf2_per_objfile instead of
	objfile.
	(create_partial_symtab): Access objfile through
	dwarf2_per_objfile.
	(process_psymtab_comp_unit_reader): Likewise.
	(read_comp_units_from_section): Likewise.
	(scan_partial_symbols): Likewise.
	(add_partial_symbol): Likewise.
	(add_partial_subprogram): Likewise.
	(peek_die_abbrev): Likewise.
	(fixup_go_packaging): Likewise.
	(process_full_comp_unit): Likewise.
	(process_full_type_unit): Likewise.
	(process_imported_unit_die): Likewise.
	(dwarf2_compute_name): Likewise.
	(dwarf2_physname): Likewise.
	(read_import_statement): Likewise.
	(create_cus_hash_table): Assign dwarf2_physname instead of
	objfile.
	(read_func_scope): Access objfile through dwarf2_per_objfile.
	(read_lexical_block_scope): Likewise.
	(read_call_site_scope): Likewise.
	(read_variable): Likewise.
	(dwarf2_rnglists_process): Likewise.
	(dwarf2_ranges_process): Likewise.
	(dwarf2_ranges_read): Likewise.
	(dwarf2_record_block_ranges): Likewise.
	(dwarf2_add_field): Likewise.
	(dwarf2_add_member_fn): Likewise.
	(read_structure_type): Likewise.
	(process_structure_scope): Likewise.
	(read_enumeration_type): Likewise.
	(read_array_type): Likewise.
	(read_common_block): Likewise.
	(read_namespace_type): Likewise.
	(read_namespace): Likewise.
	(read_module_type): Likewise.
	(read_tag_pointer_type): Likewise.
	(read_tag_ptr_to_member_type): Likewise.
	(read_tag_string_type): Likewise.
	(read_subroutine_type): Likewise.
	(read_typedef): Likewise.
	(read_base_type): Likewise.
	(attr_to_dynamic_prop): Likewise.
	(read_subrange_type): Likewise.
	(read_unspecified_type): Likewise.
	(load_partial_dies): Likewise.
	(read_partial_die): Likewise.
	(find_partial_die): Likewise.
	(guess_partial_die_structure_name): Likewise.
	(fixup_partial_die): Likewise.
	(read_attribute_value): Likewise.
	(read_addr_index_from_leb128): Likewise.
	(dwarf2_read_addr_index): Likewise.
	(dwarf2_string_attr): Likewise.
	(lnp_state_machine::check_line_address): Likewise.
	(dwarf_decode_lines_1): Likewise.
	(dwarf_decode_lines): Likewise.
	(dwarf2_start_symtab): Likewise.
	(var_decode_location): Likewise.
	(new_symbol_full): Likewise.
	(dwarf2_const_value_data): Likewise.
	(dwarf2_const_value_attr): Likewise.
	(dwarf2_const_value): Likewise.
	(die_type): Likewise.
	(die_containing_type): Likewise.
	(lookup_die_type): Likewise.
	(guess_full_die_structure_name): Likewise.
	(anonymous_struct_prefix): Likewise.
	(dwarf2_name): Likewise.
	(follow_die_ref_or_sig): Likewise.
	(follow_die_offset): Likewise.
	(follow_die_ref): Likewise.
	(dwarf2_fetch_die_loc_sect_off): Likewise.
	(dwarf2_fetch_constant_bytes): Likewise.
	(dwarf2_fetch_die_type_sect_off): Likewise.
	(dwarf2_get_die_type): Likewise.
	(follow_die_sig): Likewise.
	(decode_locdesc): Likewise.
	(dwarf2_per_cu_objfile): Likewise.
	(dwarf2_per_cu_text_offset): Likewise.
	(init_one_comp_unit): Assign dwarf2_per_objfile instead of
	objfile.
	(set_die_type): Access objfile through
	dwarf2_per_objfile.
This commit is contained in:
Simon Marchi
2018-01-07 11:22:45 -05:00
parent 2cc050302c
commit e3b9454612
2 changed files with 220 additions and 111 deletions

@ -1,3 +1,101 @@
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(struct dwarf2_per_cu_data) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(create_cu_from_index_list): Assign dwarf2_per_objfile instead
of objfile.
(create_signatured_type_table_from_index): Likewise.
(create_debug_type_hash_table): Likewise.
(fill_in_sig_entry_from_dwo_entry): Likewise.
(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
(create_type_unit_group): Assign dwarf2_per_objfile instead of
objfile.
(create_partial_symtab): Access objfile through
dwarf2_per_objfile.
(process_psymtab_comp_unit_reader): Likewise.
(read_comp_units_from_section): Likewise.
(scan_partial_symbols): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(peek_die_abbrev): Likewise.
(fixup_go_packaging): Likewise.
(process_full_comp_unit): Likewise.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(read_import_statement): Likewise.
(create_cus_hash_table): Assign dwarf2_physname instead of
objfile.
(read_func_scope): Access objfile through dwarf2_per_objfile.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(read_variable): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_structure_type): Likewise.
(process_structure_scope): Likewise.
(read_enumeration_type): Likewise.
(read_array_type): Likewise.
(read_common_block): Likewise.
(read_namespace_type): Likewise.
(read_namespace): Likewise.
(read_module_type): Likewise.
(read_tag_pointer_type): Likewise.
(read_tag_ptr_to_member_type): Likewise.
(read_tag_string_type): Likewise.
(read_subroutine_type): Likewise.
(read_typedef): Likewise.
(read_base_type): Likewise.
(attr_to_dynamic_prop): Likewise.
(read_subrange_type): Likewise.
(read_unspecified_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_addr_index_from_leb128): Likewise.
(dwarf2_read_addr_index): Likewise.
(dwarf2_string_attr): Likewise.
(lnp_state_machine::check_line_address): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(dwarf2_start_symtab): Likewise.
(var_decode_location): Likewise.
(new_symbol_full): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf2_const_value): Likewise.
(die_type): Likewise.
(die_containing_type): Likewise.
(lookup_die_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(dwarf2_name): Likewise.
(follow_die_ref_or_sig): Likewise.
(follow_die_offset): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig): Likewise.
(decode_locdesc): Likewise.
(dwarf2_per_cu_objfile): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
(init_one_comp_unit): Assign dwarf2_per_objfile instead of
objfile.
(set_die_type): Access objfile through
dwarf2_per_objfile.
2018-01-07 Simon Marchi <simon.marchi@ericsson.com> 2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* valprint.c (converted_character_d): Remove typedef. * valprint.c (converted_character_d): Remove typedef.

@ -639,8 +639,8 @@ DEF_VEC_O (delayed_method_info);
/* Internal state when decoding a particular compilation unit. */ /* Internal state when decoding a particular compilation unit. */
struct dwarf2_cu struct dwarf2_cu
{ {
/* The objfile containing this compilation unit. */ /* The dwarf2_per_objfile containing this compilation unit. */
struct objfile *objfile; struct dwarf2_per_objfile *dwarf2_per_objfile;
/* The header of the compilation unit. */ /* The header of the compilation unit. */
struct comp_unit_head header; struct comp_unit_head header;
@ -835,10 +835,8 @@ struct dwarf2_per_cu_data
dummy CUs (a CU header, but nothing else). */ dummy CUs (a CU header, but nothing else). */
struct dwarf2_cu *cu; struct dwarf2_cu *cu;
/* The corresponding objfile. /* The corresponding dwarf2_per_objfile. */
Normally we can get the objfile from dwarf2_per_objfile. struct dwarf2_per_objfile *dwarf2_per_objfile;
However we can enter this file with just a "per_cu" handle. */
struct objfile *objfile;
/* When dwarf2_per_objfile->using_index is true, the 'quick' field /* When dwarf2_per_objfile->using_index is true, the 'quick' field
is active. Otherwise, the 'psymtab' field is active. */ is active. Otherwise, the 'psymtab' field is active. */
@ -3183,7 +3181,7 @@ create_cu_from_index_list (struct objfile *objfile,
struct dwarf2_per_cu_data); struct dwarf2_per_cu_data);
the_cu->sect_off = sect_off; the_cu->sect_off = sect_off;
the_cu->length = length; the_cu->length = length;
the_cu->objfile = objfile; the_cu->dwarf2_per_objfile = dwarf2_per_objfile;
the_cu->section = section; the_cu->section = section;
the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data); struct dwarf2_per_cu_quick_data);
@ -3285,7 +3283,7 @@ create_signatured_type_table_from_index (struct objfile *objfile,
sig_type->per_cu.is_debug_types = 1; sig_type->per_cu.is_debug_types = 1;
sig_type->per_cu.section = section; sig_type->per_cu.section = section;
sig_type->per_cu.sect_off = sect_off; sig_type->per_cu.sect_off = sect_off;
sig_type->per_cu.objfile = objfile; sig_type->per_cu.dwarf2_per_objfile = dwarf2_per_objfile;
sig_type->per_cu.v.quick sig_type->per_cu.v.quick
= OBSTACK_ZALLOC (&objfile->objfile_obstack, = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data); struct dwarf2_per_cu_quick_data);
@ -3344,7 +3342,7 @@ create_signatured_type_table_from_debug_names
sig_type->per_cu.is_debug_types = 1; sig_type->per_cu.is_debug_types = 1;
sig_type->per_cu.section = section; sig_type->per_cu.section = section;
sig_type->per_cu.sect_off = sect_off; sig_type->per_cu.sect_off = sect_off;
sig_type->per_cu.objfile = objfile; sig_type->per_cu.dwarf2_per_objfile = dwarf2_per_objfile;
sig_type->per_cu.v.quick sig_type->per_cu.v.quick
= OBSTACK_ZALLOC (&objfile->objfile_obstack, = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data); struct dwarf2_per_cu_quick_data);
@ -6992,7 +6990,7 @@ create_debug_type_hash_table (struct dwo_file *dwo_file,
struct signatured_type); struct signatured_type);
sig_type->signature = header.signature; sig_type->signature = header.signature;
sig_type->type_offset_in_tu = header.type_cu_offset_in_tu; sig_type->type_offset_in_tu = header.type_cu_offset_in_tu;
sig_type->per_cu.objfile = objfile; sig_type->per_cu.dwarf2_per_objfile = dwarf2_per_objfile;
sig_type->per_cu.is_debug_types = 1; sig_type->per_cu.is_debug_types = 1;
sig_type->per_cu.section = section; sig_type->per_cu.section = section;
sig_type->per_cu.sect_off = sect_off; sig_type->per_cu.sect_off = sect_off;
@ -7177,7 +7175,7 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile,
sig_entry->per_cu.sect_off = dwo_entry->sect_off; sig_entry->per_cu.sect_off = dwo_entry->sect_off;
sig_entry->per_cu.length = dwo_entry->length; sig_entry->per_cu.length = dwo_entry->length;
sig_entry->per_cu.reading_dwo_directly = 1; sig_entry->per_cu.reading_dwo_directly = 1;
sig_entry->per_cu.objfile = objfile; sig_entry->per_cu.dwarf2_per_objfile = dwarf2_per_objfile;
sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu; sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu;
sig_entry->dwo_unit = dwo_entry; sig_entry->dwo_unit = dwo_entry;
} }
@ -7603,7 +7601,7 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
if (! attr) if (! attr)
error (_("Dwarf Error: missing dwo_id for dwo_name %s" error (_("Dwarf Error: missing dwo_id for dwo_name %s"
" [in module %s]"), " [in module %s]"),
dwo_name, objfile_name (this_cu->objfile)); dwo_name, objfile_name (this_cu->dwarf2_per_objfile->objfile));
signature = DW_UNSND (attr); signature = DW_UNSND (attr);
dwo_unit = lookup_dwo_comp_unit (this_cu, dwo_name, comp_dir, dwo_unit = lookup_dwo_comp_unit (this_cu, dwo_name, comp_dir,
signature); signature);
@ -8100,7 +8098,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
tu_group = OBSTACK_ZALLOC (&objfile->objfile_obstack, tu_group = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct type_unit_group); struct type_unit_group);
per_cu = &tu_group->per_cu; per_cu = &tu_group->per_cu;
per_cu->objfile = objfile; per_cu->dwarf2_per_objfile = cu->dwarf2_per_objfile;
if (dwarf2_per_objfile->using_index) if (dwarf2_per_objfile->using_index)
{ {
@ -8200,7 +8198,7 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
static struct partial_symtab * static struct partial_symtab *
create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name) create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
{ {
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
struct partial_symtab *pst; struct partial_symtab *pst;
pst = start_psymtab_common (objfile, name, 0, pst = start_psymtab_common (objfile, name, 0,
@ -8242,7 +8240,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
void *data) void *data)
{ {
struct dwarf2_cu *cu = reader->cu; struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct dwarf2_per_cu_data *per_cu = cu->per_cu; struct dwarf2_per_cu_data *per_cu = cu->per_cu;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -8882,7 +8880,7 @@ read_comp_units_from_section (struct objfile *objfile,
this_cu->sect_off = sect_off; this_cu->sect_off = sect_off;
this_cu->length = cu_header.length + cu_header.initial_length_size; this_cu->length = cu_header.length + cu_header.initial_length_size;
this_cu->is_dwz = is_dwz; this_cu->is_dwz = is_dwz;
this_cu->objfile = objfile; this_cu->dwarf2_per_objfile = dwarf2_per_objfile;
this_cu->section = section; this_cu->section = section;
if (*n_comp_units == *n_allocated) if (*n_comp_units == *n_allocated)
@ -9013,12 +9011,12 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
{ {
error (_("Dwarf Error: DW_TAG_imported_unit is not" error (_("Dwarf Error: DW_TAG_imported_unit is not"
" supported in type units [in module %s]"), " supported in type units [in module %s]"),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
} }
per_cu = dwarf2_find_containing_comp_unit (pdi->d.sect_off, per_cu = dwarf2_find_containing_comp_unit
pdi->is_dwz, (pdi->d.sect_off, pdi->is_dwz,
cu->objfile); cu->dwarf2_per_objfile->objfile);
/* Go read the partial unit, if needed. */ /* Go read the partial unit, if needed. */
if (per_cu->v.psymtab == NULL) if (per_cu->v.psymtab == NULL)
@ -9180,7 +9178,7 @@ partial_die_full_name (struct partial_die_info *pdi,
static void static void
add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR addr = 0; CORE_ADDR addr = 0;
const char *actual_name = NULL; const char *actual_name = NULL;
@ -9422,7 +9420,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
*highpc = pdi->highpc; *highpc = pdi->highpc;
if (set_addrmap) if (set_addrmap)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
CORE_ADDR highpc; CORE_ADDR highpc;
@ -9508,7 +9506,7 @@ static struct abbrev_info *
peek_die_abbrev (const gdb_byte *info_ptr, unsigned int *bytes_read, peek_die_abbrev (const gdb_byte *info_ptr, unsigned int *bytes_read,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
bfd *abfd = cu->objfile->obfd; bfd *abfd = cu->dwarf2_per_objfile->objfile->obfd;
unsigned int abbrev_number; unsigned int abbrev_number;
struct abbrev_info *abbrev; struct abbrev_info *abbrev;
@ -10181,13 +10179,14 @@ fixup_go_packaging (struct dwarf2_cu *cu)
package_name = this_package_name; package_name = this_package_name;
else else
{ {
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
if (strcmp (package_name, this_package_name) != 0) if (strcmp (package_name, this_package_name) != 0)
complaint (&symfile_complaints, complaint (&symfile_complaints,
_("Symtab %s has objects from two different Go packages: %s and %s"), _("Symtab %s has objects from two different Go packages: %s and %s"),
(symbol_symtab (sym) != NULL (symbol_symtab (sym) != NULL
? symtab_to_filename_for_display ? symtab_to_filename_for_display
(symbol_symtab (sym)) (symbol_symtab (sym))
: objfile_name (cu->objfile)), : objfile_name (objfile)),
this_package_name, package_name); this_package_name, package_name);
xfree (this_package_name); xfree (this_package_name);
} }
@ -10197,7 +10196,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
if (package_name != NULL) if (package_name != NULL)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *saved_package_name const char *saved_package_name
= (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack, = (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
package_name, package_name,
@ -10374,7 +10373,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
enum language pretend_language) enum language pretend_language)
{ {
struct dwarf2_cu *cu = per_cu->cu; struct dwarf2_cu *cu = per_cu->cu;
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR lowpc, highpc; CORE_ADDR lowpc, highpc;
struct compunit_symtab *cust; struct compunit_symtab *cust;
@ -10478,7 +10477,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
enum language pretend_language) enum language pretend_language)
{ {
struct dwarf2_cu *cu = per_cu->cu; struct dwarf2_cu *cu = per_cu->cu;
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
struct compunit_symtab *cust; struct compunit_symtab *cust;
struct cleanup *delayed_list_cleanup; struct cleanup *delayed_list_cleanup;
struct signatured_type *sig_type; struct signatured_type *sig_type;
@ -10556,7 +10555,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
{ {
error (_("Dwarf Error: DW_TAG_imported_unit is not" error (_("Dwarf Error: DW_TAG_imported_unit is not"
" supported in type units [in module %s]"), " supported in type units [in module %s]"),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
} }
attr = dwarf2_attr (die, DW_AT_import, cu); attr = dwarf2_attr (die, DW_AT_import, cu);
@ -10565,7 +10564,8 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
sect_offset sect_off = dwarf2_get_ref_die_offset (attr); sect_offset sect_off = dwarf2_get_ref_die_offset (attr);
bool is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz); bool is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz);
dwarf2_per_cu_data *per_cu dwarf2_per_cu_data *per_cu
= dwarf2_find_containing_comp_unit (sect_off, is_dwz, cu->objfile); = dwarf2_find_containing_comp_unit (sect_off, is_dwz,
cu->dwarf2_per_objfile->objfile);
/* If necessary, add it to the queue and load its DIEs. */ /* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, cu->language)) if (maybe_queue_comp_unit (cu, per_cu, cu->language))
@ -10822,7 +10822,7 @@ dwarf2_compute_name (const char *name,
struct die_info *die, struct dwarf2_cu *cu, struct die_info *die, struct dwarf2_cu *cu,
int physname) int physname)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
if (name == NULL) if (name == NULL)
name = dwarf2_name (die, cu); name = dwarf2_name (die, cu);
@ -11071,7 +11071,7 @@ dwarf2_full_name (const char *name, struct die_info *die, struct dwarf2_cu *cu)
static const char * static const char *
dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *retval, *mangled = NULL, *canon = NULL; const char *retval, *mangled = NULL, *canon = NULL;
int need_copy = 1; int need_copy = 1;
@ -11245,7 +11245,7 @@ using_directives (enum language language)
static void static void
read_import_statement (struct die_info *die, struct dwarf2_cu *cu) read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct attribute *import_attr; struct attribute *import_attr;
struct die_info *imported_die, *child_die; struct die_info *imported_die, *child_die;
struct dwarf2_cu *imported_cu; struct dwarf2_cu *imported_cu;
@ -11954,7 +11954,7 @@ create_cus_hash_table (struct dwo_file &dwo_file, dwarf2_section_info &section,
memset (&create_dwo_cu_data.dwo_unit, 0, memset (&create_dwo_cu_data.dwo_unit, 0,
sizeof (create_dwo_cu_data.dwo_unit)); sizeof (create_dwo_cu_data.dwo_unit));
memset (&per_cu, 0, sizeof (per_cu)); memset (&per_cu, 0, sizeof (per_cu));
per_cu.objfile = objfile; per_cu.dwarf2_per_objfile = dwarf2_per_objfile;
per_cu.is_debug_types = 0; per_cu.is_debug_types = 0;
per_cu.sect_off = sect_offset (info_ptr - section.buffer); per_cu.sect_off = sect_offset (info_ptr - section.buffer);
per_cu.section = &section; per_cu.section = &section;
@ -13659,7 +13659,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
static void static void
read_func_scope (struct die_info *die, struct dwarf2_cu *cu) read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct context_stack *newobj; struct context_stack *newobj;
CORE_ADDR lowpc; CORE_ADDR lowpc;
@ -13850,7 +13850,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
static void static void
read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct context_stack *newobj; struct context_stack *newobj;
CORE_ADDR lowpc, highpc; CORE_ADDR lowpc, highpc;
@ -13921,7 +13921,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
static void static void
read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR pc, baseaddr; CORE_ADDR pc, baseaddr;
struct attribute *attr; struct attribute *attr;
@ -14075,7 +14075,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct die_info *target_die; struct die_info *target_die;
target_die = follow_die_ref (die, attr, &target_cu); target_die = follow_die_ref (die, attr, &target_cu);
gdb_assert (target_cu->objfile == objfile); gdb_assert (target_cu->dwarf2_per_objfile->objfile == objfile);
if (die_is_declaration (target_die, target_cu)) if (die_is_declaration (target_die, target_cu))
{ {
const char *target_physname; const char *target_physname;
@ -14277,7 +14277,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
if (containing_type != NULL) if (containing_type != NULL)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack, storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct rust_vtable_symbol); struct rust_vtable_symbol);
@ -14302,7 +14302,7 @@ static bool
dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu, dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
Callback &&callback) Callback &&callback)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
bfd *obfd = objfile->obfd; bfd *obfd = objfile->obfd;
/* Base address selection entry. */ /* Base address selection entry. */
CORE_ADDR base; CORE_ADDR base;
@ -14468,7 +14468,7 @@ static int
dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
Callback &&callback) Callback &&callback)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
bfd *obfd = objfile->obfd; bfd *obfd = objfile->obfd;
unsigned int addr_size = cu_header->addr_size; unsigned int addr_size = cu_header->addr_size;
@ -14575,7 +14575,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
CORE_ADDR *high_return, struct dwarf2_cu *cu, CORE_ADDR *high_return, struct dwarf2_cu *cu,
struct partial_symtab *ranges_pst) struct partial_symtab *ranges_pst)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
const CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets, const CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile)); SECT_OFF_TEXT (objfile));
@ -14816,7 +14816,7 @@ static void
dwarf2_record_block_ranges (struct die_info *die, struct block *block, dwarf2_record_block_ranges (struct die_info *die, struct block *block,
CORE_ADDR baseaddr, struct dwarf2_cu *cu) CORE_ADDR baseaddr, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct attribute *attr; struct attribute *attr;
struct attribute *attr_high; struct attribute *attr_high;
@ -15000,7 +15000,7 @@ static void
dwarf2_add_field (struct field_info *fip, struct die_info *die, dwarf2_add_field (struct field_info *fip, struct die_info *die,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct nextfield *new_field; struct nextfield *new_field;
struct attribute *attr; struct attribute *attr;
@ -15399,7 +15399,7 @@ static void
dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
struct type *type, struct dwarf2_cu *cu) struct type *type, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct attribute *attr; struct attribute *attr;
struct fnfieldlist *flp; struct fnfieldlist *flp;
int i; int i;
@ -15711,7 +15711,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
static struct type * static struct type *
read_structure_type (struct die_info *die, struct dwarf2_cu *cu) read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *type; struct type *type;
struct attribute *attr; struct attribute *attr;
const char *name; const char *name;
@ -15834,7 +15834,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
static void static void
process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct die_info *child_die; struct die_info *child_die;
struct type *type; struct type *type;
@ -16134,7 +16134,7 @@ update_enumeration_type_from_children (struct die_info *die,
static struct type * static struct type *
read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *type; struct type *type;
struct attribute *attr; struct attribute *attr;
const char *name; const char *name;
@ -16306,7 +16306,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_array_type (struct die_info *die, struct dwarf2_cu *cu) read_array_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct die_info *child_die; struct die_info *child_die;
struct type *type; struct type *type;
struct type *element_type, *range_type, *index_type; struct type *element_type, *range_type, *index_type;
@ -16336,7 +16336,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
_("unable to read array DW_AT_byte_stride " _("unable to read array DW_AT_byte_stride "
" - DIE at 0x%x [in module %s]"), " - DIE at 0x%x [in module %s]"),
to_underlying (die->sect_off), to_underlying (die->sect_off),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
/* Ignore this attribute. We will likely not be able to print /* Ignore this attribute. We will likely not be able to print
arrays of this type correctly, but there is little we can do arrays of this type correctly, but there is little we can do
to help if we cannot read the attribute's value. */ to help if we cannot read the attribute's value. */
@ -16598,7 +16598,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL) if (die->child != NULL)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct die_info *child_die; struct die_info *child_die;
size_t n_entries = 0, size; size_t n_entries = 0, size;
struct common_block *common_block; struct common_block *common_block;
@ -16643,7 +16643,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
"DW_AT_data_member_location " "DW_AT_data_member_location "
"- DIE at 0x%x [in module %s]"), "- DIE at 0x%x [in module %s]"),
to_underlying (child_die->sect_off), to_underlying (child_die->sect_off),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
if (attr_form_is_section_offset (member_loc)) if (attr_form_is_section_offset (member_loc))
dwarf2_complex_location_expr_complaint (); dwarf2_complex_location_expr_complaint ();
@ -16670,7 +16670,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_namespace_type (struct die_info *die, struct dwarf2_cu *cu) read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *previous_prefix, *name; const char *previous_prefix, *name;
int is_anonymous; int is_anonymous;
struct type *type; struct type *type;
@ -16710,7 +16710,7 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
static void static void
read_namespace (struct die_info *die, struct dwarf2_cu *cu) read_namespace (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
int is_anonymous; int is_anonymous;
/* Add a symbol associated to this if we haven't seen the namespace /* Add a symbol associated to this if we haven't seen the namespace
@ -16755,7 +16755,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_module_type (struct die_info *die, struct dwarf2_cu *cu) read_module_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *module_name; const char *module_name;
struct type *type; struct type *type;
@ -16829,7 +16829,7 @@ namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu)
static struct type * static struct type *
read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct gdbarch *gdbarch = get_objfile_arch (cu->objfile); struct gdbarch *gdbarch = get_objfile_arch (cu->dwarf2_per_objfile->objfile);
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
struct type *type; struct type *type;
struct attribute *attr_byte_size; struct attribute *attr_byte_size;
@ -16910,7 +16910,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
type = lookup_methodptr_type (to_type); type = lookup_methodptr_type (to_type);
else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC) else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC)
{ {
struct type *new_type = alloc_type (cu->objfile); struct type *new_type = alloc_type (cu->dwarf2_per_objfile->objfile);
smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type), smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type), TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type),
@ -17073,7 +17073,7 @@ read_tag_atomic_type (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct type *type, *range_type, *index_type, *char_type; struct type *type, *range_type, *index_type, *char_type;
struct attribute *attr; struct attribute *attr;
@ -17151,7 +17151,7 @@ prototyped_function_p (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *type; /* Type that this function returns. */ struct type *type; /* Type that this function returns. */
struct type *ftype; /* Function that returns above type. */ struct type *ftype; /* Function that returns above type. */
struct attribute *attr; struct attribute *attr;
@ -17288,7 +17288,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
static struct type * static struct type *
read_typedef (struct die_info *die, struct dwarf2_cu *cu) read_typedef (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *name = NULL; const char *name = NULL;
struct type *this_type, *target_type; struct type *this_type, *target_type;
@ -17339,7 +17339,7 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name,
static struct type * static struct type *
read_base_type (struct die_info *die, struct dwarf2_cu *cu) read_base_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *type; struct type *type;
struct attribute *attr; struct attribute *attr;
int encoding = 0, bits = 0; int encoding = 0, bits = 0;
@ -17451,7 +17451,7 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
struct dwarf2_cu *cu, struct dynamic_prop *prop) struct dwarf2_cu *cu, struct dynamic_prop *prop)
{ {
struct dwarf2_property_baton *baton; struct dwarf2_property_baton *baton;
struct obstack *obstack = &cu->objfile->objfile_obstack; struct obstack *obstack = &cu->dwarf2_per_objfile->objfile->objfile_obstack;
if (attr == NULL || prop == NULL) if (attr == NULL || prop == NULL)
return 0; return 0;
@ -17612,7 +17612,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
else if (!low_default_is_valid) else if (!low_default_is_valid)
complaint (&symfile_complaints, _("Missing DW_AT_lower_bound " complaint (&symfile_complaints, _("Missing DW_AT_lower_bound "
"- DIE at 0x%x [in module %s]"), "- DIE at 0x%x [in module %s]"),
to_underlying (die->sect_off), objfile_name (cu->objfile)); to_underlying (die->sect_off),
objfile_name (cu->dwarf2_per_objfile->objfile));
attr = dwarf2_attr (die, DW_AT_upper_bound, cu); attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
if (!attr_to_dynamic_prop (attr, die, cu, &high)) if (!attr_to_dynamic_prop (attr, die, cu, &high))
@ -17642,7 +17643,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
high bound or count are not yet handled by this code. */ high bound or count are not yet handled by this code. */
if (TYPE_CODE (base_type) == TYPE_CODE_VOID) if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
int addr_size = gdbarch_addr_bit (gdbarch) /8; int addr_size = gdbarch_addr_bit (gdbarch) /8;
struct type *int_type = objfile_type (objfile)->builtin_int; struct type *int_type = objfile_type (objfile)->builtin_int;
@ -17712,7 +17713,7 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct type *type; struct type *type;
type = init_type (cu->objfile, TYPE_CODE_VOID, 0, NULL); type = init_type (cu->dwarf2_per_objfile->objfile, TYPE_CODE_VOID, 0, NULL);
TYPE_NAME (type) = dwarf2_name (die, cu); TYPE_NAME (type) = dwarf2_name (die, cu);
/* In Ada, an unspecified type is typically used when the description /* In Ada, an unspecified type is typically used when the description
@ -18161,7 +18162,7 @@ load_partial_dies (const struct die_reader_specs *reader,
const gdb_byte *info_ptr, int building_psymtab) const gdb_byte *info_ptr, int building_psymtab)
{ {
struct dwarf2_cu *cu = reader->cu; struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct partial_die_info *part_die; struct partial_die_info *part_die;
struct partial_die_info *parent_die, *last_die, *first_die = NULL; struct partial_die_info *parent_die, *last_die, *first_die = NULL;
struct abbrev_info *abbrev; struct abbrev_info *abbrev;
@ -18438,7 +18439,7 @@ read_partial_die (const struct die_reader_specs *reader,
const gdb_byte *info_ptr) const gdb_byte *info_ptr)
{ {
struct dwarf2_cu *cu = reader->cu; struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const gdb_byte *buffer = reader->buffer; const gdb_byte *buffer = reader->buffer;
unsigned int i; unsigned int i;
struct attribute attr; struct attribute attr;
@ -18675,7 +18676,7 @@ find_partial_die_in_comp_unit (sect_offset sect_off, struct dwarf2_cu *cu)
static struct partial_die_info * static struct partial_die_info *
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu) find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct dwarf2_per_cu_data *per_cu = NULL; struct dwarf2_per_cu_data *per_cu = NULL;
struct partial_die_info *pd = NULL; struct partial_die_info *pd = NULL;
@ -18776,9 +18777,10 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
child_pdi->linkage_name); child_pdi->linkage_name);
if (actual_class_name != NULL) if (actual_class_name != NULL)
{ {
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct_pdi->name struct_pdi->name
= ((const char *) = ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, obstack_copy0 (&objfile->per_bfd->storage_obstack,
actual_class_name, actual_class_name,
strlen (actual_class_name))); strlen (actual_class_name)));
xfree (actual_class_name); xfree (actual_class_name);
@ -18864,9 +18866,10 @@ fixup_partial_die (struct partial_die_info *part_die,
else else
base = demangled; base = demangled;
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
part_die->name part_die->name
= ((const char *) = ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, obstack_copy0 (&objfile->per_bfd->storage_obstack,
base, strlen (base))); base, strlen (base)));
xfree (demangled); xfree (demangled);
} }
@ -18883,7 +18886,7 @@ read_attribute_value (const struct die_reader_specs *reader,
LONGEST implicit_const, const gdb_byte *info_ptr) LONGEST implicit_const, const gdb_byte *info_ptr)
{ {
struct dwarf2_cu *cu = reader->cu; struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
bfd *abfd = reader->abfd; bfd *abfd = reader->abfd;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
@ -19579,7 +19582,7 @@ static CORE_ADDR
read_addr_index_from_leb128 (struct dwarf2_cu *cu, const gdb_byte *info_ptr, read_addr_index_from_leb128 (struct dwarf2_cu *cu, const gdb_byte *info_ptr,
unsigned int *bytes_read) unsigned int *bytes_read)
{ {
bfd *abfd = cu->objfile->obfd; bfd *abfd = cu->dwarf2_per_objfile->objfile->obfd;
unsigned int addr_index = read_unsigned_leb128 (abfd, info_ptr, bytes_read); unsigned int addr_index = read_unsigned_leb128 (abfd, info_ptr, bytes_read);
return read_addr_index (cu, addr_index); return read_addr_index (cu, addr_index);
@ -19620,7 +19623,7 @@ CORE_ADDR
dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
unsigned int addr_index) unsigned int addr_index)
{ {
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
struct dwarf2_cu *cu = per_cu->cu; struct dwarf2_cu *cu = per_cu->cu;
ULONGEST addr_base; ULONGEST addr_base;
int addr_size; int addr_size;
@ -19853,7 +19856,7 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
_("string type expected for attribute %s for " _("string type expected for attribute %s for "
"DIE at 0x%x in module %s"), "DIE at 0x%x in module %s"),
dwarf_attr_name (name), to_underlying (die->sect_off), dwarf_attr_name (name), to_underlying (die->sect_off),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
} }
return str; return str;
@ -20739,7 +20742,7 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
/* This line table is for a function which has been /* This line table is for a function which has been
GCd by the linker. Ignore it. PR gdb/12528 */ GCd by the linker. Ignore it. PR gdb/12528 */
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
long line_offset = line_ptr - get_debug_line_section (cu)->buffer; long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
complaint (&symfile_complaints, complaint (&symfile_complaints,
@ -20765,7 +20768,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
unsigned int bytes_read, extended_len; unsigned int bytes_read, extended_len;
unsigned char op_code, extended_op; unsigned char op_code, extended_op;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
/* True if we're recording line info (as opposed to building partial /* True if we're recording line info (as opposed to building partial
@ -20996,7 +20999,7 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
struct dwarf2_cu *cu, struct partial_symtab *pst, struct dwarf2_cu *cu, struct partial_symtab *pst,
CORE_ADDR lowpc, int decode_mapping) CORE_ADDR lowpc, int decode_mapping)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const int decode_for_pst_p = (pst != NULL); const int decode_for_pst_p = (pst != NULL);
if (decode_mapping) if (decode_mapping)
@ -21096,7 +21099,8 @@ dwarf2_start_symtab (struct dwarf2_cu *cu,
const char *name, const char *comp_dir, CORE_ADDR low_pc) const char *name, const char *comp_dir, CORE_ADDR low_pc)
{ {
struct compunit_symtab *cust struct compunit_symtab *cust
= start_symtab (cu->objfile, name, comp_dir, low_pc, cu->language); = start_symtab (cu->dwarf2_per_objfile->objfile, name, comp_dir, low_pc,
cu->language);
record_debugformat ("DWARF 2"); record_debugformat ("DWARF 2");
record_producer (cu->producer); record_producer (cu->producer);
@ -21113,7 +21117,7 @@ static void
var_decode_location (struct attribute *attr, struct symbol *sym, var_decode_location (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
/* NOTE drow/2003-01-30: There used to be a comment and some special /* NOTE drow/2003-01-30: There used to be a comment and some special
@ -21186,7 +21190,7 @@ static struct symbol *
new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
struct symbol *space) struct symbol *space)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym = NULL; struct symbol *sym = NULL;
const char *name; const char *name;
@ -21584,7 +21588,7 @@ static gdb_byte *
dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack, dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
struct dwarf2_cu *cu, LONGEST *value, int bits) struct dwarf2_cu *cu, LONGEST *value, int bits)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
enum bfd_endian byte_order = bfd_big_endian (objfile->obfd) ? enum bfd_endian byte_order = bfd_big_endian (objfile->obfd) ?
BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
LONGEST l = DW_UNSND (attr); LONGEST l = DW_UNSND (attr);
@ -21619,7 +21623,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
LONGEST *value, const gdb_byte **bytes, LONGEST *value, const gdb_byte **bytes,
struct dwarf2_locexpr_baton **baton) struct dwarf2_locexpr_baton **baton)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
struct dwarf_block *blk; struct dwarf_block *blk;
enum bfd_endian byte_order = (bfd_big_endian (objfile->obfd) ? enum bfd_endian byte_order = (bfd_big_endian (objfile->obfd) ?
@ -21721,7 +21725,7 @@ static void
dwarf2_const_value (const struct attribute *attr, struct symbol *sym, dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
LONGEST value; LONGEST value;
const gdb_byte *bytes; const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton; struct dwarf2_locexpr_baton *baton;
@ -21759,7 +21763,7 @@ die_type (struct die_info *die, struct dwarf2_cu *cu)
if (!type_attr) if (!type_attr)
{ {
/* A missing DW_AT_type represents a void type. */ /* A missing DW_AT_type represents a void type. */
return objfile_type (cu->objfile)->builtin_void; return objfile_type (cu->dwarf2_per_objfile->objfile)->builtin_void;
} }
return lookup_die_type (die, type_attr, cu); return lookup_die_type (die, type_attr, cu);
@ -21826,7 +21830,7 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu)
type_attr = dwarf2_attr (die, DW_AT_containing_type, cu); type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
if (!type_attr) if (!type_attr)
error (_("Dwarf Error: Problem turning containing type into gdb type " error (_("Dwarf Error: Problem turning containing type into gdb type "
"[in module %s]"), objfile_name (cu->objfile)); "[in module %s]"), objfile_name (cu->dwarf2_per_objfile->objfile));
return lookup_die_type (die, type_attr, cu); return lookup_die_type (die, type_attr, cu);
} }
@ -21859,7 +21863,7 @@ static struct type *
lookup_die_type (struct die_info *die, const struct attribute *attr, lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *this_type; struct type *this_type;
gdb_assert (attr->name == DW_AT_type gdb_assert (attr->name == DW_AT_type
@ -21873,7 +21877,7 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_per_cu_data *per_cu; struct dwarf2_per_cu_data *per_cu;
sect_offset sect_off = dwarf2_get_ref_die_offset (attr); sect_offset sect_off = dwarf2_get_ref_die_offset (attr);
per_cu = dwarf2_find_containing_comp_unit (sect_off, 1, cu->objfile); per_cu = dwarf2_find_containing_comp_unit (sect_off, 1, objfile);
this_type = get_die_type_at_offset (sect_off, per_cu); this_type = get_die_type_at_offset (sect_off, per_cu);
} }
else if (attr_form_is_ref (attr)) else if (attr_form_is_ref (attr))
@ -22042,6 +22046,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
struct die_info *spec_die; struct die_info *spec_die;
struct dwarf2_cu *spec_cu; struct dwarf2_cu *spec_cu;
struct die_info *child; struct die_info *child;
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
spec_cu = cu; spec_cu = cu;
spec_die = die_specification (die, &spec_cu); spec_die = die_specification (die, &spec_cu);
@ -22083,7 +22088,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
&& actual_name[actual_name_len && actual_name[actual_name_len
- die_name_len - 1] == ':') - die_name_len - 1] == ':')
name = (char *) obstack_copy0 ( name = (char *) obstack_copy0 (
&cu->objfile->per_bfd->storage_obstack, &objfile->per_bfd->storage_obstack,
actual_name, actual_name_len - die_name_len - 2); actual_name, actual_name_len - die_name_len - 2);
} }
} }
@ -22125,7 +22130,8 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':') if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
return ""; return "";
return (char *) obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
return (char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
DW_STRING (attr), DW_STRING (attr),
&base[-1] - DW_STRING (attr)); &base[-1] - DW_STRING (attr));
} }
@ -22393,6 +22399,7 @@ static const char *
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct attribute *attr; struct attribute *attr;
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
attr = dwarf2_attr (die, DW_AT_name, cu); attr = dwarf2_attr (die, DW_AT_name, cu);
if ((!attr || !DW_STRING (attr)) if ((!attr || !DW_STRING (attr))
@ -22455,7 +22462,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
/* FIXME: we already did this for the partial symbol... */ /* FIXME: we already did this for the partial symbol... */
DW_STRING (attr) DW_STRING (attr)
= ((const char *) = ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, obstack_copy0 (&objfile->per_bfd->storage_obstack,
demangled, strlen (demangled))); demangled, strlen (demangled)));
DW_STRING_IS_CANONICAL (attr) = 1; DW_STRING_IS_CANONICAL (attr) = 1;
xfree (demangled); xfree (demangled);
@ -22479,7 +22486,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{ {
DW_STRING (attr) DW_STRING (attr)
= dwarf2_canonicalize_name (DW_STRING (attr), cu, = dwarf2_canonicalize_name (DW_STRING (attr), cu,
&cu->objfile->per_bfd->storage_obstack); &objfile->per_bfd->storage_obstack);
DW_STRING_IS_CANONICAL (attr) = 1; DW_STRING_IS_CANONICAL (attr) = 1;
} }
return DW_STRING (attr); return DW_STRING (attr);
@ -22813,7 +22820,7 @@ follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr,
{ {
dump_die_for_error (src_die); dump_die_for_error (src_die);
error (_("Dwarf Error: Expected reference attribute [in module %s]"), error (_("Dwarf Error: Expected reference attribute [in module %s]"),
objfile_name ((*ref_cu)->objfile)); objfile_name ((*ref_cu)->dwarf2_per_objfile->objfile));
} }
return die; return die;
@ -22830,6 +22837,7 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
{ {
struct die_info temp_die; struct die_info temp_die;
struct dwarf2_cu *target_cu, *cu = *ref_cu; struct dwarf2_cu *target_cu, *cu = *ref_cu;
struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
gdb_assert (cu->per_cu != NULL); gdb_assert (cu->per_cu != NULL);
@ -22849,7 +22857,7 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
struct dwarf2_per_cu_data *per_cu; struct dwarf2_per_cu_data *per_cu;
per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz, per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz,
cu->objfile); objfile);
/* If necessary, add it to the queue and load its DIEs. */ /* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, cu->language)) if (maybe_queue_comp_unit (cu, per_cu, cu->language))
@ -22891,14 +22899,15 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr,
error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE " error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE "
"at 0x%x [in module %s]"), "at 0x%x [in module %s]"),
to_underlying (sect_off), to_underlying (src_die->sect_off), to_underlying (sect_off), to_underlying (src_die->sect_off),
objfile_name (cu->objfile)); objfile_name (cu->dwarf2_per_objfile->objfile));
return die; return die;
} }
/* Return DWARF block referenced by DW_AT_location of DIE at SECT_OFF at PER_CU. /* Return DWARF block referenced by DW_AT_location of DIE at SECT_OFF at PER_CU.
Returned value is intended for DW_OP_call*. Returned Returned value is intended for DW_OP_call*. Returned
dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE. */ dwarf2_locexpr_baton->data has lifetime of
PER_CU->DWARF2_PER_OBJFILE->OBJFILE. */
struct dwarf2_locexpr_baton struct dwarf2_locexpr_baton
dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
@ -22910,8 +22919,9 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
struct die_info *die; struct die_info *die;
struct attribute *attr; struct attribute *attr;
struct dwarf2_locexpr_baton retval; struct dwarf2_locexpr_baton retval;
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
dw2_setup (per_cu->objfile); dw2_setup (objfile);
if (per_cu->cu == NULL) if (per_cu->cu == NULL)
load_cu (per_cu); load_cu (per_cu);
@ -22921,13 +22931,13 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
/* We shouldn't get here for a dummy CU, but don't crash on the user. /* We shouldn't get here for a dummy CU, but don't crash on the user.
Instead just throw an error, not much else we can do. */ Instead just throw an error, not much else we can do. */
error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"), error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"),
to_underlying (sect_off), objfile_name (per_cu->objfile)); to_underlying (sect_off), objfile_name (objfile));
} }
die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
if (!die) if (!die)
error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"),
to_underlying (sect_off), objfile_name (per_cu->objfile)); to_underlying (sect_off), objfile_name (objfile));
attr = dwarf2_attr (die, DW_AT_location, cu); attr = dwarf2_attr (die, DW_AT_location, cu);
if (!attr) if (!attr)
@ -22955,7 +22965,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
if (!attr_form_is_block (attr)) if (!attr_form_is_block (attr))
error (_("Dwarf Error: DIE at 0x%x referenced in module %s " error (_("Dwarf Error: DIE at 0x%x referenced in module %s "
"is neither DW_FORM_block* nor DW_FORM_exprloc"), "is neither DW_FORM_block* nor DW_FORM_exprloc"),
to_underlying (sect_off), objfile_name (per_cu->objfile)); to_underlying (sect_off), objfile_name (objfile));
retval.data = DW_BLOCK (attr)->data; retval.data = DW_BLOCK (attr)->data;
retval.size = DW_BLOCK (attr)->size; retval.size = DW_BLOCK (attr)->size;
@ -23018,8 +23028,9 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
struct type *type; struct type *type;
LONGEST value; LONGEST value;
enum bfd_endian byte_order; enum bfd_endian byte_order;
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
dw2_setup (per_cu->objfile); dw2_setup (objfile);
if (per_cu->cu == NULL) if (per_cu->cu == NULL)
load_cu (per_cu); load_cu (per_cu);
@ -23029,20 +23040,20 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
/* We shouldn't get here for a dummy CU, but don't crash on the user. /* We shouldn't get here for a dummy CU, but don't crash on the user.
Instead just throw an error, not much else we can do. */ Instead just throw an error, not much else we can do. */
error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"), error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"),
to_underlying (sect_off), objfile_name (per_cu->objfile)); to_underlying (sect_off), objfile_name (objfile));
} }
die = follow_die_offset (sect_off, per_cu->is_dwz, &cu); die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
if (!die) if (!die)
error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"),
to_underlying (sect_off), objfile_name (per_cu->objfile)); to_underlying (sect_off), objfile_name (objfile));
attr = dwarf2_attr (die, DW_AT_const_value, cu); attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr == NULL) if (attr == NULL)
return NULL; return NULL;
byte_order = (bfd_big_endian (per_cu->objfile->obfd) byte_order = (bfd_big_endian (objfile->obfd)
? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE); ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
switch (attr->form) switch (attr->form)
@ -23144,7 +23155,7 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off,
struct dwarf2_cu *cu; struct dwarf2_cu *cu;
struct die_info *die; struct die_info *die;
dw2_setup (per_cu->objfile); dw2_setup (per_cu->dwarf2_per_objfile->objfile);
if (per_cu->cu == NULL) if (per_cu->cu == NULL)
load_cu (per_cu); load_cu (per_cu);
@ -23166,7 +23177,7 @@ struct type *
dwarf2_get_die_type (cu_offset die_offset, dwarf2_get_die_type (cu_offset die_offset,
struct dwarf2_per_cu_data *per_cu) struct dwarf2_per_cu_data *per_cu)
{ {
dw2_setup (per_cu->objfile); dw2_setup (per_cu->dwarf2_per_objfile->objfile);
sect_offset die_offset_sect = per_cu->sect_off + to_underlying (die_offset); sect_offset die_offset_sect = per_cu->sect_off + to_underlying (die_offset);
return get_die_type_at_offset (die_offset_sect, per_cu); return get_die_type_at_offset (die_offset_sect, per_cu);
@ -23243,7 +23254,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
error (_("Dwarf Error: Cannot find signatured DIE %s referenced" error (_("Dwarf Error: Cannot find signatured DIE %s referenced"
" from DIE at 0x%x [in module %s]"), " from DIE at 0x%x [in module %s]"),
hex_string (signature), to_underlying (src_die->sect_off), hex_string (signature), to_underlying (src_die->sect_off),
objfile_name ((*ref_cu)->objfile)); objfile_name ((*ref_cu)->dwarf2_per_objfile->objfile));
} }
die = follow_die_sig_1 (src_die, sig_type, ref_cu); die = follow_die_sig_1 (src_die, sig_type, ref_cu);
@ -23253,7 +23264,7 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
error (_("Dwarf Error: Problem reading signatured DIE %s referenced" error (_("Dwarf Error: Problem reading signatured DIE %s referenced"
" from DIE at 0x%x [in module %s]"), " from DIE at 0x%x [in module %s]"),
hex_string (signature), to_underlying (src_die->sect_off), hex_string (signature), to_underlying (src_die->sect_off),
objfile_name ((*ref_cu)->objfile)); objfile_name ((*ref_cu)->dwarf2_per_objfile->objfile));
} }
return die; return die;
@ -23451,7 +23462,7 @@ read_signatured_type (struct signatured_type *sig_type)
static CORE_ADDR static CORE_ADDR
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
size_t i; size_t i;
size_t size = blk->size; size_t size = blk->size;
const gdb_byte *data = blk->data; const gdb_byte *data = blk->data;
@ -24817,7 +24828,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
struct objfile * struct objfile *
dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu) dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu)
{ {
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
/* Return the master objfile, so that we can report and look up the /* Return the master objfile, so that we can report and look up the
correct file containing this variable. */ correct file containing this variable. */
@ -24899,7 +24910,7 @@ dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *per_cu)
CORE_ADDR CORE_ADDR
dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu) dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
{ {
struct objfile *objfile = per_cu->objfile; struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
} }
@ -24972,7 +24983,7 @@ init_one_comp_unit (struct dwarf2_cu *cu, struct dwarf2_per_cu_data *per_cu)
memset (cu, 0, sizeof (*cu)); memset (cu, 0, sizeof (*cu));
per_cu->cu = cu; per_cu->cu = cu;
cu->per_cu = per_cu; cu->per_cu = per_cu;
cu->objfile = per_cu->objfile; cu->dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
obstack_init (&cu->comp_unit_obstack); obstack_init (&cu->comp_unit_obstack);
} }
@ -25192,7 +25203,7 @@ static struct type *
set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{ {
struct dwarf2_per_cu_offset_and_type **slot, ofs; struct dwarf2_per_cu_offset_and_type **slot, ofs;
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct attribute *attr; struct attribute *attr;
struct dynamic_prop prop; struct dynamic_prop prop;