value);
}
-/* Find DW_TAG_call_site's DW_AT_call_target address.
- CALLER_FRAME (for registers) can be NULL if it is not known. This function
- always returns valid address or it throws NO_ENTRY_VALUE_ERROR. */
+/* See gdbtypes.h. */
-static CORE_ADDR
-call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
- struct call_site *call_site,
- struct frame_info *caller_frame)
+CORE_ADDR
+call_site_target::address (struct gdbarch *call_site_gdbarch,
+ const struct call_site *call_site,
+ struct frame_info *caller_frame) const
{
- switch (call_site->target.loc_kind ())
+ switch (m_loc_kind)
{
case call_site_target::DWARF_BLOCK:
{
struct type *caller_core_addr_type;
struct gdbarch *caller_arch;
- dwarf_block = call_site->target.loc_dwarf_block ();
+ dwarf_block = m_loc.dwarf_block;
if (dwarf_block == NULL)
{
struct bound_minimal_symbol msym;
const char *physname;
struct bound_minimal_symbol msym;
- physname = call_site->target.loc_physname ();
+ physname = m_loc.physname;
/* Handle both the mangled and demangled PHYSNAME. */
msym = lookup_minimal_symbol (physname, NULL, NULL);
int sect_idx = cust->block_line_section ();
CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
- return call_site->target.loc_physaddr () + delta;
+ return m_loc.physaddr + delta;
}
default:
/* CALLER_FRAME with registers is not available for tail-call jumped
frames. */
- target_addr = call_site_to_target_addr (gdbarch, call_site, NULL);
+ target_addr = call_site->address (gdbarch, nullptr);
if (target_addr == verify_addr)
{
/* CALLER_FRAME with registers is not available for tail-call jumped
frames. */
- target_func_addr = call_site_to_target_addr (gdbarch, call_site, NULL);
+ target_func_addr = call_site->address (gdbarch, nullptr);
if (target_func_addr == callee_pc)
{
caller_pc = get_frame_pc (caller_frame);
call_site = call_site_for_pc (gdbarch, caller_pc);
- target_addr = call_site_to_target_addr (gdbarch, call_site, caller_frame);
+ target_addr = call_site->address (gdbarch, caller_frame);
if (target_addr != func_addr)
{
struct minimal_symbol *target_msym, *func_msym;
DWARF_BLOCK,
};
- kind loc_kind () const
- {
- return m_loc_kind;
- }
-
- CORE_ADDR loc_physaddr () const
- {
- gdb_assert (m_loc_kind == PHYSADDR);
- return m_loc.physaddr;
- }
-
void set_loc_physaddr (CORE_ADDR physaddr)
{
m_loc_kind = PHYSADDR;
m_loc.physaddr = physaddr;
}
- const char *loc_physname () const
- {
- gdb_assert (m_loc_kind == PHYSNAME);
- return m_loc.physname;
- }
-
void set_loc_physname (const char *physname)
{
m_loc_kind = PHYSNAME;
m_loc.physname = physname;
}
- dwarf2_locexpr_baton *loc_dwarf_block () const
- {
- gdb_assert (m_loc_kind == DWARF_BLOCK);
- return m_loc.dwarf_block;
- }
-
void set_loc_dwarf_block (dwarf2_locexpr_baton *dwarf_block)
{
m_loc_kind = DWARF_BLOCK;
m_loc.dwarf_block = dwarf_block;
}
+ /* Find DW_TAG_call_site's DW_AT_call_target address. CALLER_FRAME
+ (for registers) can be NULL if it is not known. This function
+ always returns valid address or it throws
+ NO_ENTRY_VALUE_ERROR. */
+
+ CORE_ADDR address (struct gdbarch *call_site_gdbarch,
+ const struct call_site *call_site,
+ struct frame_info *caller_frame) const;
+
+private:
+
union
{
/* Address. */
CORE_ADDR pc () const;
+ /* Find the target address. CALLER_FRAME (for registers) can be
+ NULL if it is not known. This function always returns valid
+ address or it throws NO_ENTRY_VALUE_ERROR. */
+
+ CORE_ADDR address (struct gdbarch *call_site_gdbarch,
+ struct frame_info *caller_frame) const
+ {
+ return target.address (call_site_gdbarch, this, caller_frame);
+ }
+
/* * List successor with head in FUNC_TYPE.TAIL_CALL_LIST. */
struct call_site *tail_call_next = nullptr;