Re: [PATCH 6/8] Use BLOCK_ENTRY_PC to find function entry pc in infrun.c

Simon Marchi
2018-08-01T02:28:09Z

On 2018-06-26 02:53 AM, Kevin Buettner wrote:
> find_pc_partial_function() still returns the lowest and highest address
> of a function even when that function contains non-contiguous ranges.
> In cases where greater discrimination is required, the BLOCK parameter
> may be examined to determine the actual entry PC.
>
> This patch uses the BLOCK return value from find_pc_partial_function()
> to obtain the entry PC. If no block is found - which can happen when
> only minimal symbols are available - then the start address provided
> by find_pc_partial_function() will still be used (as before).

This one looks good to me, given how the stop_func_start field seems to
be used. From what I understand, it is used as the entry point of the
function, therefore BLOCK_ENTRY_PC seems appropriate.

> @@ -4297,10 +4297,20 @@ fill_in_stop_func (struct gdbarch *gdbarch,
> {
> if (!ecs->stop_func_filled_in)
> {
> + const struct block *block;
> +
> /* Don't care about return value; stop_func_start and stop_func_name
> will both be 0 if it doesn't work. */
> find_pc_partial_function (stop_pc, &ecs->stop_func_name,
> - &ecs->stop_func_start, &ecs->stop_func_end);
> + &ecs->stop_func_start, &ecs->stop_func_end,
> + &block);
> +
> + /* If a block is returned, prefer the block's entry point instead of
> + the lowest address of the block - these aren't necessarily the
> + same. */
> + if (block)

block != nullptr

Simon