static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
CORE_ADDR *, CORE_ADDR *,
struct dwarf2_cu *,
- dwarf2_psymtab *);
+ addrmap *,
+ void *);
static void get_scope_pc_bounds (struct die_info *,
CORE_ADDR *, CORE_ADDR *,
/* Possibly set the default values of LOWPC and HIGHPC from
`DW_AT_ranges'. */
- cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
- &best_highpc, cu, pst);
+ cu_bounds_kind
+ = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
+ &best_highpc, cu,
+ per_bfd->partial_symtabs->psymtabs_addrmap,
+ pst);
if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
{
CORE_ADDR low
scan_partial_symbols (pdi->die_child, lowpc, highpc, set_addrmap, cu);
}
-static int
-dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
- dwarf2_psymtab *, dwarf_tag);
+static int dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
+ CORE_ADDR *high_return, struct dwarf2_cu *cu,
+ addrmap *map, void *datum, dwarf_tag tag);
/* Read a partial die corresponding to a subprogram or an inlined
subprogram and create a partial symbol for that subprogram.
if (pdi->has_range_info
&& dwarf2_ranges_read (pdi->ranges_offset, &pdi->lowpc, &pdi->highpc,
cu,
+ (set_addrmap
+ ? cu->per_objfile->per_bfd->partial_symtabs->psymtabs_addrmap
+ : nullptr),
set_addrmap ? cu->per_cu->v.psymtab : nullptr,
pdi->tag))
{
}
/* Ignore functions with missing or invalid low and high pc attributes. */
- if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, nullptr, nullptr)
<= PC_BOUNDS_INVALID)
{
attr = dwarf2_attr (die, DW_AT_external, cu);
as multiple lexical blocks? Handling children in a sane way would
be nasty. Might be easier to properly extend generic blocks to
describe ranges. */
- switch (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ switch (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, nullptr, nullptr))
{
case PC_BOUNDS_NOT_PRESENT:
/* DW_TAG_lexical_block has no attributes, process its children as if
CORE_ADDR lowpc;
/* DW_AT_entry_pc should be preferred. */
- if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
+ if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu,
+ nullptr, nullptr)
<= PC_BOUNDS_INVALID)
complaint (_("DW_AT_call_target target DIE has invalid "
"low pc, for referencing DIE %s [in module %s]"),
/* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET.
Return 1 if the attributes are present and valid, otherwise, return 0.
- If RANGES_PST is not NULL we should set up the `psymtabs_addrmap'. */
+ TAG is passed to dwarf2_ranges_process. If MAP is not NULL, then
+ ranges in MAP are set, using DATUM as the value. */
static int
dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
CORE_ADDR *high_return, struct dwarf2_cu *cu,
- dwarf2_psymtab *ranges_pst, dwarf_tag tag)
+ addrmap *map, void *datum, dwarf_tag tag)
{
struct objfile *objfile = cu->per_objfile->objfile;
- dwarf2_per_bfd *per_bfd = cu->per_objfile->per_bfd;
struct gdbarch *gdbarch = objfile->arch ();
const CORE_ADDR baseaddr = objfile->text_section_offset ();
int low_set = 0;
retval = dwarf2_ranges_process (offset, cu, tag,
[&] (CORE_ADDR range_beginning, CORE_ADDR range_end)
{
- if (ranges_pst != NULL)
+ if (map != nullptr)
{
CORE_ADDR lowpc;
CORE_ADDR highpc;
highpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
range_end + baseaddr)
- baseaddr);
- addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap,
- lowpc, highpc - 1, ranges_pst);
+ addrmap_set_empty (map, lowpc, highpc - 1, datum);
}
/* FIXME: This is recording everything as a low-high
static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR *highpc, struct dwarf2_cu *cu,
- dwarf2_psymtab *pst)
+ addrmap *map, void *datum)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct attribute *attr;
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
- if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst,
- die->tag))
+ if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu,
+ map, datum, die->tag))
return PC_BOUNDS_INVALID;
/* Found discontinuous range of addresses. */
ret = PC_BOUNDS_RANGES;
CORE_ADDR low, high;
struct die_info *child = die->child;
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL) >= PC_BOUNDS_RANGES)
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, nullptr, nullptr)
+ >= PC_BOUNDS_RANGES)
{
*lowpc = std::min (*lowpc, low);
*highpc = std::max (*highpc, high);
CORE_ADDR best_high = (CORE_ADDR) 0;
CORE_ADDR current_low, current_high;
- if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL)
+ if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu,
+ nullptr, nullptr)
>= PC_BOUNDS_RANGES)
{
best_low = current_low;