/* Internal state when decoding a particular compilation unit. */
struct dwarf2_cu
{
- /* The objfile containing this compilation unit. */
- struct objfile *objfile;
+ /* The dwarf2_per_objfile containing this compilation unit. */
+ struct dwarf2_per_objfile *dwarf2_per_objfile;
/* The header of the compilation unit. */
struct comp_unit_head header;
dummy CUs (a CU header, but nothing else). */
struct dwarf2_cu *cu;
- /* The corresponding objfile.
- Normally we can get the objfile from dwarf2_per_objfile.
- However we can enter this file with just a "per_cu" handle. */
- struct objfile *objfile;
+ /* The corresponding dwarf2_per_objfile. */
+ struct dwarf2_per_objfile *dwarf2_per_objfile;
/* When dwarf2_per_objfile->using_index is true, the 'quick' field
is active. Otherwise, the 'psymtab' field is active. */
struct dwarf2_per_cu_data);
the_cu->sect_off = sect_off;
the_cu->length = length;
- the_cu->objfile = objfile;
+ the_cu->dwarf2_per_objfile = dwarf2_per_objfile;
the_cu->section = section;
the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data);
sig_type->per_cu.is_debug_types = 1;
sig_type->per_cu.section = section;
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
= OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data);
sig_type->per_cu.is_debug_types = 1;
sig_type->per_cu.section = section;
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
= OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data);
struct signatured_type);
sig_type->signature = header.signature;
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.section = section;
sig_type->per_cu.sect_off = sect_off;
sig_entry->per_cu.sect_off = dwo_entry->sect_off;
sig_entry->per_cu.length = dwo_entry->length;
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->dwo_unit = dwo_entry;
}
if (! attr)
error (_("Dwarf Error: missing dwo_id for dwo_name %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);
dwo_unit = lookup_dwo_comp_unit (this_cu, dwo_name, comp_dir,
signature);
tu_group = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct type_unit_group);
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)
{
static struct partial_symtab *
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;
pst = start_psymtab_common (objfile, name, 0,
void *data)
{
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 dwarf2_per_cu_data *per_cu = cu->per_cu;
CORE_ADDR baseaddr;
this_cu->sect_off = sect_off;
this_cu->length = cu_header.length + cu_header.initial_length_size;
this_cu->is_dwz = is_dwz;
- this_cu->objfile = objfile;
+ this_cu->dwarf2_per_objfile = dwarf2_per_objfile;
this_cu->section = section;
if (*n_comp_units == *n_allocated)
{
error (_("Dwarf Error: DW_TAG_imported_unit is not"
" 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,
- pdi->is_dwz,
- cu->objfile);
+ per_cu = dwarf2_find_containing_comp_unit
+ (pdi->d.sect_off, pdi->is_dwz,
+ cu->dwarf2_per_objfile->objfile);
/* Go read the partial unit, if needed. */
if (per_cu->v.psymtab == NULL)
static void
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);
CORE_ADDR addr = 0;
const char *actual_name = NULL;
*highpc = pdi->highpc;
if (set_addrmap)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR baseaddr;
CORE_ADDR highpc;
peek_die_abbrev (const gdb_byte *info_ptr, unsigned int *bytes_read,
struct dwarf2_cu *cu)
{
- bfd *abfd = cu->objfile->obfd;
+ bfd *abfd = cu->dwarf2_per_objfile->objfile->obfd;
unsigned int abbrev_number;
struct abbrev_info *abbrev;
package_name = this_package_name;
else
{
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
if (strcmp (package_name, this_package_name) != 0)
complaint (&symfile_complaints,
_("Symtab %s has objects from two different Go packages: %s and %s"),
(symbol_symtab (sym) != NULL
? symtab_to_filename_for_display
(symbol_symtab (sym))
- : objfile_name (cu->objfile)),
+ : objfile_name (objfile)),
this_package_name, package_name);
xfree (this_package_name);
}
if (package_name != NULL)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
const char *saved_package_name
= (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
package_name,
enum language pretend_language)
{
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);
CORE_ADDR lowpc, highpc;
struct compunit_symtab *cust;
enum language pretend_language)
{
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 cleanup *delayed_list_cleanup;
struct signatured_type *sig_type;
{
error (_("Dwarf Error: DW_TAG_imported_unit is not"
" 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);
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);
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 (maybe_queue_comp_unit (cu, per_cu, cu->language))
struct die_info *die, struct dwarf2_cu *cu,
int physname)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
if (name == NULL)
name = dwarf2_name (die, cu);
static const char *
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;
int need_copy = 1;
static void
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 die_info *imported_die, *child_die;
struct dwarf2_cu *imported_cu;
memset (&create_dwo_cu_data.dwo_unit, 0,
sizeof (create_dwo_cu_data.dwo_unit));
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.sect_off = sect_offset (info_ptr - section.buffer);
per_cu.section = §ion;
static void
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 context_stack *newobj;
CORE_ADDR lowpc;
static void
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 context_stack *newobj;
CORE_ADDR lowpc, highpc;
static void
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);
CORE_ADDR pc, baseaddr;
struct attribute *attr;
struct die_info *target_die;
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))
{
const char *target_physname;
if (containing_type != NULL)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct rust_vtable_symbol);
dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
Callback &&callback)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
bfd *obfd = objfile->obfd;
/* Base address selection entry. */
CORE_ADDR base;
dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
Callback &&callback)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct comp_unit_head *cu_header = &cu->header;
bfd *obfd = objfile->obfd;
unsigned int addr_size = cu_header->addr_size;
CORE_ADDR *high_return, struct dwarf2_cu *cu,
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);
const CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
dwarf2_record_block_ranges (struct die_info *die, struct block *block,
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 attribute *attr;
struct attribute *attr_high;
dwarf2_add_field (struct field_info *fip, 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 nextfield *new_field;
struct attribute *attr;
dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
struct type *type, struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct attribute *attr;
struct fnfieldlist *flp;
int i;
static struct type *
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 attribute *attr;
const char *name;
static void
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 type *type;
static struct type *
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 attribute *attr;
const char *name;
static struct type *
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 type *type;
struct type *element_type, *range_type, *index_type;
_("unable to read array DW_AT_byte_stride "
" - DIE at 0x%x [in module %s]"),
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
arrays of this type correctly, but there is little we can do
to help if we cannot read the attribute's value. */
if (die->child != NULL)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct die_info *child_die;
size_t n_entries = 0, size;
struct common_block *common_block;
"DW_AT_data_member_location "
"- DIE at 0x%x [in module %s]"),
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))
dwarf2_complex_location_expr_complaint ();
static struct type *
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;
int is_anonymous;
struct type *type;
static void
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;
/* Add a symbol associated to this if we haven't seen the namespace
static struct type *
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;
struct type *type;
static struct type *
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 type *type;
struct attribute *attr_byte_size;
type = lookup_methodptr_type (to_type);
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),
TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type),
static struct type *
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 type *type, *range_type, *index_type, *char_type;
struct attribute *attr;
static struct type *
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 *ftype; /* Function that returns above type. */
struct attribute *attr;
static struct type *
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;
struct type *this_type, *target_type;
static struct type *
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 attribute *attr;
int encoding = 0, bits = 0;
struct dwarf2_cu *cu, struct dynamic_prop *prop)
{
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)
return 0;
else if (!low_default_is_valid)
complaint (&symfile_complaints, _("Missing DW_AT_lower_bound "
"- 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);
if (!attr_to_dynamic_prop (attr, die, cu, &high))
high bound or count are not yet handled by this code. */
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);
int addr_size = gdbarch_addr_bit (gdbarch) /8;
struct type *int_type = objfile_type (objfile)->builtin_int;
{
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);
/* In Ada, an unspecified type is typically used when the description
const gdb_byte *info_ptr, int building_psymtab)
{
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 *parent_die, *last_die, *first_die = NULL;
struct abbrev_info *abbrev;
const gdb_byte *info_ptr)
{
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;
unsigned int i;
struct attribute attr;
static struct partial_die_info *
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 partial_die_info *pd = NULL;
child_pdi->linkage_name);
if (actual_class_name != NULL)
{
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct_pdi->name
= ((const char *)
- obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
actual_class_name,
strlen (actual_class_name)));
xfree (actual_class_name);
else
base = demangled;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
part_die->name
= ((const char *)
- obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
base, strlen (base)));
xfree (demangled);
}
LONGEST implicit_const, const gdb_byte *info_ptr)
{
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);
bfd *abfd = reader->abfd;
struct comp_unit_head *cu_header = &cu->header;
read_addr_index_from_leb128 (struct dwarf2_cu *cu, const gdb_byte *info_ptr,
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);
return read_addr_index (cu, addr_index);
dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
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;
ULONGEST addr_base;
int addr_size;
_("string type expected for attribute %s for "
"DIE at 0x%x in module %s"),
dwarf_attr_name (name), to_underlying (die->sect_off),
- objfile_name (cu->objfile));
+ objfile_name (cu->dwarf2_per_objfile->objfile));
}
return str;
/* This line table is for a function which has been
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;
complaint (&symfile_complaints,
unsigned int bytes_read, extended_len;
unsigned char op_code, extended_op;
CORE_ADDR baseaddr;
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
bfd *abfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
/* True if we're recording line info (as opposed to building partial
struct dwarf2_cu *cu, struct partial_symtab *pst,
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);
if (decode_mapping)
const char *name, const char *comp_dir, CORE_ADDR low_pc)
{
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_producer (cu->producer);
var_decode_location (struct attribute *attr, struct symbol *sym,
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;
/* NOTE drow/2003-01-30: There used to be a comment and some special
new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
struct symbol *space)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym = NULL;
const char *name;
dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
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) ?
BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
LONGEST l = DW_UNSND (attr);
LONGEST *value, const gdb_byte **bytes,
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 dwarf_block *blk;
enum bfd_endian byte_order = (bfd_big_endian (objfile->obfd) ?
dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
LONGEST value;
const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
if (!type_attr)
{
/* 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);
type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
if (!type_attr)
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);
}
lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->objfile;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
struct type *this_type;
gdb_assert (attr->name == DW_AT_type
struct dwarf2_per_cu_data *per_cu;
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);
}
else if (attr_form_is_ref (attr))
struct die_info *spec_die;
struct dwarf2_cu *spec_cu;
struct die_info *child;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
spec_cu = cu;
spec_die = die_specification (die, &spec_cu);
&& actual_name[actual_name_len
- die_name_len - 1] == ':')
name = (char *) obstack_copy0 (
- &cu->objfile->per_bfd->storage_obstack,
+ &objfile->per_bfd->storage_obstack,
actual_name, actual_name_len - die_name_len - 2);
}
}
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
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),
&base[-1] - DW_STRING (attr));
}
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
attr = dwarf2_attr (die, DW_AT_name, cu);
if ((!attr || !DW_STRING (attr))
/* FIXME: we already did this for the partial symbol... */
DW_STRING (attr)
= ((const char *)
- obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
demangled, strlen (demangled)));
DW_STRING_IS_CANONICAL (attr) = 1;
xfree (demangled);
{
DW_STRING (attr)
= dwarf2_canonicalize_name (DW_STRING (attr), cu,
- &cu->objfile->per_bfd->storage_obstack);
+ &objfile->per_bfd->storage_obstack);
DW_STRING_IS_CANONICAL (attr) = 1;
}
return DW_STRING (attr);
{
dump_die_for_error (src_die);
error (_("Dwarf Error: Expected reference attribute [in module %s]"),
- objfile_name ((*ref_cu)->objfile));
+ objfile_name ((*ref_cu)->dwarf2_per_objfile->objfile));
}
return die;
{
struct die_info temp_die;
struct dwarf2_cu *target_cu, *cu = *ref_cu;
+ struct objfile *objfile = cu->dwarf2_per_objfile->objfile;
gdb_assert (cu->per_cu != NULL);
struct dwarf2_per_cu_data *per_cu;
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 (maybe_queue_comp_unit (cu, per_cu, cu->language))
error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE "
"at 0x%x [in module %s]"),
to_underlying (sect_off), to_underlying (src_die->sect_off),
- objfile_name (cu->objfile));
+ objfile_name (cu->dwarf2_per_objfile->objfile));
return die;
}
/* 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
- 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
dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
struct die_info *die;
struct attribute *attr;
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)
load_cu (per_cu);
/* 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. */
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);
if (!die)
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);
if (!attr)
if (!attr_form_is_block (attr))
error (_("Dwarf Error: DIE at 0x%x referenced in module %s "
"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.size = DW_BLOCK (attr)->size;
struct type *type;
LONGEST value;
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)
load_cu (per_cu);
/* 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. */
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);
if (!die)
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);
if (attr == 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);
switch (attr->form)
struct dwarf2_cu *cu;
struct die_info *die;
- dw2_setup (per_cu->objfile);
+ dw2_setup (per_cu->dwarf2_per_objfile->objfile);
if (per_cu->cu == NULL)
load_cu (per_cu);
dwarf2_get_die_type (cu_offset die_offset,
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);
return get_die_type_at_offset (die_offset_sect, per_cu);
error (_("Dwarf Error: Cannot find signatured DIE %s referenced"
" from DIE at 0x%x [in module %s]"),
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);
error (_("Dwarf Error: Problem reading signatured DIE %s referenced"
" from DIE at 0x%x [in module %s]"),
hex_string (signature), to_underlying (src_die->sect_off),
- objfile_name ((*ref_cu)->objfile));
+ objfile_name ((*ref_cu)->dwarf2_per_objfile->objfile));
}
return die;
static CORE_ADDR
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 size = blk->size;
const gdb_byte *data = blk->data;
struct objfile *
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
correct file containing this variable. */
CORE_ADDR
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));
}
memset (cu, 0, sizeof (*cu));
per_cu->cu = 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);
}
set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
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 dynamic_prop prop;