Introduce symbol_block_ops::get_block_value

This adds a new callback to symbol_block_ops.  This callback lets a
LOC_BLOCK symbol implement its own function to find the underlying
block.
This commit is contained in:
Tom Tromey
2022-12-19 11:25:48 -07:00
parent bb051d7a30
commit 36ed3d84e0
2 changed files with 11 additions and 1 deletions

View File

@@ -6412,7 +6412,8 @@ register_symbol_block_impl (enum address_class aclass,
/* Sanity check OPS. */
gdb_assert (ops != NULL);
gdb_assert (ops->find_frame_base_location != NULL);
gdb_assert (ops->find_frame_base_location != nullptr
|| ops->get_block_value != nullptr);
return result;
}

View File

@@ -1182,6 +1182,12 @@ struct symbol_block_ops
the corresponding DW_AT_frame_base attribute. */
CORE_ADDR (*get_frame_base) (struct symbol *framefunc,
frame_info_ptr frame);
/* Return the block for this function. So far, this is used to
implement function aliases. So, if this is set, then it's not
necessary to set the other functions in this structure; and vice
versa. */
const block *(*get_block_value) (const struct symbol *sym);
};
/* Functions used with LOC_REGISTER and LOC_REGPARM_ADDR. */
@@ -1536,6 +1542,9 @@ struct block_symbol
inline const block *
symbol::value_block () const
{
if (SYMBOL_BLOCK_OPS (this) != nullptr
&& SYMBOL_BLOCK_OPS (this)->get_block_value != nullptr)
return SYMBOL_BLOCK_OPS (this)->get_block_value (this);
return m_value.block;
}