}
break;
+ case call_site_target::ADDRESSES:
+ {
+ dwarf2_per_objfile *per_objfile = call_site->per_objfile;
+ compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
+ int sect_idx = cust->block_line_section ();
+ CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
+
+ for (unsigned i = 0; i < m_loc.addresses.length; ++i)
+ callback (m_loc.addresses.values[i] + delta);
+ }
+ break;
+
default:
internal_error (__FILE__, __LINE__, _("invalid call site target kind"));
}
cu->get_builder ()->set_local_using_directives (cstk.local_using_directives);
}
+static void dwarf2_ranges_read_low_addrs (unsigned offset,
+ struct dwarf2_cu *cu,
+ dwarf_tag tag,
+ std::vector<CORE_ADDR> &result);
+
/* Read in DW_TAG_call_site and insert it to CU->call_site_htab. */
static void
target_die = follow_die_ref (die, attr, &target_cu);
gdb_assert (target_cu->per_objfile->objfile == objfile);
+
+ struct attribute *ranges_attr
+ = dwarf2_attr (target_die, DW_AT_ranges, target_cu);
+
if (die_is_declaration (target_die, target_cu))
{
const char *target_physname;
else
call_site->target.set_loc_physname (target_physname);
}
+ else if (ranges_attr != nullptr && ranges_attr->form_is_unsigned ())
+ {
+ ULONGEST ranges_offset = (ranges_attr->as_unsigned ()
+ + target_cu->gnu_ranges_base);
+ std::vector<CORE_ADDR> addresses;
+ dwarf2_ranges_read_low_addrs (ranges_offset, target_cu,
+ target_die->tag, addresses);
+ CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
+ addresses.size ());
+ std::copy (addresses.begin (), addresses.end (), saved);
+ call_site->target.set_loc_array (addresses.size (), saved);
+ }
else
{
CORE_ADDR lowpc;
return 1;
}
+/* Process ranges and fill in a vector of the low PC values only. */
+
+static void
+dwarf2_ranges_read_low_addrs (unsigned offset, struct dwarf2_cu *cu,
+ dwarf_tag tag,
+ std::vector<CORE_ADDR> &result)
+{
+ dwarf2_ranges_process (offset, cu, tag,
+ [&] (CORE_ADDR start, CORE_ADDR end)
+ {
+ result.push_back (start);
+ });
+}
+
/* Get low and high pc attributes from a die. See enum pc_bounds_kind
definition for the return value. *LOWPC and *HIGHPC are set iff
neither PC_BOUNDS_NOT_PRESENT nor PC_BOUNDS_INVALID are returned. */
PHYSNAME,
/* A DWARF block. */
DWARF_BLOCK,
+ /* An array of addresses. */
+ ADDRESSES,
};
void set_loc_physaddr (CORE_ADDR physaddr)
m_loc.dwarf_block = dwarf_block;
}
+ void set_loc_array (unsigned length, const CORE_ADDR *data)
+ {
+ m_loc_kind = ADDRESSES;
+ m_loc.addresses.length = length;
+ m_loc.addresses.values = data;
+ }
+
/* Callback type for iterate_over_addresses. */
using iterate_ftype = gdb::function_view<void (CORE_ADDR)>;
const char *physname;
/* DWARF block. */
struct dwarf2_locexpr_baton *dwarf_block;
+ /* Array of addresses. */
+ struct
+ {
+ unsigned length;
+ const CORE_ADDR *values;
+ } addresses;
} m_loc;
/* * Discriminant for union field_location. */