Add dwarf2_per_objfile member to DWARF batons
authorTom Tromey <tom@tromey.com>
Wed, 27 May 2020 15:13:50 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:13:50 +0000 (11:13 -0400)
commita50264baf57716993e701096fa6e466fb63e0301
treee776c6ce6b5000d5bfaf252dbe4e817f28bdca91
parentd3473f0c4b8e8d791ed87b1919a666bc368497dc
Add dwarf2_per_objfile member to DWARF batons

Various DWARF callbacks expect to be able to fetch the objfile and / or
dwarf2_per_objfile from the DWARF CU object.  However, this won't be
possible once sharing is implemented.

Because these objects are related to full symbols (e.g., they are used
to implement location expressions), they can simply store the
dwarf2_per_objfile they need.

This patch adds a per_objfile member to the various "baton" structures
and arranges to set this value when constructing the baton.

gdb/ChangeLog:

YYYY-MM-DD  Tom Tromey  <tom@tromey.com>
YYYY-MM-DD  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.

Change-Id: If3aaa6a0f544be86710157c3adb68fde24d80037
gdb/ChangeLog
gdb/dwarf2/loc.c
gdb/dwarf2/loc.h
gdb/dwarf2/read.c