+2020-05-27 Tom Tromey <tom@tromey.com>
+ Simon Marchi <simon.marchi@efficios.com>
+
+ * dwarf2/loc.c (struct piece_closure) <per_objfile>: New member.
+ (allocate_piece_closure): Set "per_objfile" member.
+ (dwarf2_find_location_expression, dwarf2_locexpr_baton_eval)
+ (locexpr_describe_location, loclist_describe_location): Use new
+ member.
+ * dwarf2/read.c (read_call_site_scope)
+ (mark_common_block_symbol_computed, attr_to_dynamic_prop)
+ (dwarf2_const_value_attr, dwarf2_fetch_die_loc_sect_off)
+ (fill_in_loclist_baton, dwarf2_symbol_mark_computed,
+ handle_data_member_location): Set per_objfile member.
+ * dwarf2/loc.h (struct dwarf2_locexpr_baton) <per_objfile>: New
+ member.
+ (struct dwarf2_loclist_baton) <per_objfile>: New member.
+
2020-05-27 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_objfile) <allocate_per_cu,
dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
size_t *locexpr_length, CORE_ADDR pc)
{
- struct objfile *objfile = baton->per_cu->objfile ();
+ dwarf2_per_objfile *per_objfile = baton->per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = baton->per_cu->addr_size ();
/* Reference count. */
int refc = 0;
+ /* The objfile from which this closure's expression came. */
+ dwarf2_per_objfile *per_objfile = nullptr;
+
/* The CU from which this closure's expression came. */
struct dwarf2_per_cu_data *per_cu = NULL;
struct piece_closure *c = new piece_closure;
c->refc = 1;
+ /* We must capture this here due to sharing of DWARF state. */
+ c->per_objfile = per_cu->dwarf2_per_objfile;
c->per_cu = per_cu;
c->pieces = std::move (pieces);
if (frame == NULL)
ctx.data_view = addr_stack->valaddr;
}
- objfile = dlbaton->per_cu->objfile ();
+ objfile = dlbaton->per_objfile->objfile;
ctx.gdbarch = objfile->arch ();
ctx.addr_size = dlbaton->per_cu->addr_size ();
{
struct dwarf2_locexpr_baton *dlbaton
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
- struct objfile *objfile = dlbaton->per_cu->objfile ();
+ dwarf2_per_objfile *per_objfile = dlbaton->per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
unsigned int addr_size = dlbaton->per_cu->addr_size ();
int offset_size = dlbaton->per_cu->offset_size ();
struct dwarf2_loclist_baton *dlbaton
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol);
const gdb_byte *loc_ptr, *buf_end;
- struct objfile *objfile = dlbaton->per_cu->objfile ();
+ dwarf2_per_objfile *per_objfile = dlbaton->per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = dlbaton->per_cu->addr_size ();
static void
read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
+ dwarf2_per_objfile *per_objfile = cu->per_cu->dwarf2_per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc, baseaddr;
struct attribute *attr;
dlbaton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
dlbaton->data = DW_BLOCK (attr)->data;
dlbaton->size = DW_BLOCK (attr)->size;
+ dlbaton->per_objfile = per_objfile;
dlbaton->per_cu = cu->per_cu;
SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton);
of the field, not the value. This is why
is_reference is set to false here. */
dlbaton->is_reference = false;
+ dlbaton->per_objfile = cu->per_cu->dwarf2_per_objfile;
dlbaton->per_cu = cu->per_cu;
SET_FIELD_DWARF_BLOCK (*field, dlbaton);
struct attribute *member_loc,
struct dwarf2_cu *cu)
{
- struct dwarf2_per_objfile *dwarf2_per_objfile
- = cu->per_cu->dwarf2_per_objfile;
- struct objfile *objfile = dwarf2_per_objfile->objfile;
+ dwarf2_per_objfile *per_objfile = cu->per_cu->dwarf2_per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
struct dwarf2_locexpr_baton *baton;
gdb_byte *ptr;
unsigned int cu_off;
|| member_loc->form_is_constant ());
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ baton->per_objfile = per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
struct type *default_type)
{
struct dwarf2_property_baton *baton;
- struct obstack *obstack
- = &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack;
+ dwarf2_per_objfile *per_objfile = cu->per_cu->dwarf2_per_objfile;
+ struct objfile *objfile = per_objfile->objfile;
+ struct obstack *obstack = &objfile->objfile_obstack;
gdb_assert (default_type != NULL);
baton = XOBNEW (obstack, struct dwarf2_property_baton);
baton->property_type = default_type;
baton->locexpr.per_cu = cu->per_cu;
+ baton->locexpr.per_objfile = per_objfile;
baton->locexpr.size = DW_BLOCK (attr)->size;
baton->locexpr.data = DW_BLOCK (attr)->data;
switch (attr->name)
baton = XOBNEW (obstack, struct dwarf2_property_baton);
baton->property_type = die_type (target_die, target_cu);
baton->locexpr.per_cu = cu->per_cu;
+ baton->locexpr.per_objfile = per_objfile;
baton->locexpr.size = DW_BLOCK (target_attr)->size;
baton->locexpr.data = DW_BLOCK (target_attr)->data;
baton->locexpr.is_reference = true;
LONGEST *value, const gdb_byte **bytes,
struct dwarf2_locexpr_baton **baton)
{
- struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
+ dwarf2_per_objfile *per_objfile = cu->per_cu->dwarf2_per_objfile;
+ struct objfile *objfile = 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) ?
piggyback on the existing location code rather than writing
a new implementation of symbol_computed_ops. */
*baton = XOBNEW (obstack, struct dwarf2_locexpr_baton);
+ (*baton)->per_objfile = per_objfile;
(*baton)->per_cu = cu->per_cu;
gdb_assert ((*baton)->per_cu);
retval.data = DW_BLOCK (attr)->data;
retval.size = DW_BLOCK (attr)->size;
}
+ retval.per_objfile = dwarf2_per_objfile;
retval.per_cu = cu->per_cu;
age_cached_comp_units (dwarf2_per_objfile);
section->read (dwarf2_per_objfile->objfile);
+ baton->per_objfile = dwarf2_per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
/* We don't know how long the location list is, but make sure we
struct dwarf2_locexpr_baton *baton;
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ baton->per_objfile = dwarf2_per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);