This is similar to the code in get_frame_block that decrements the
PC before looking up its block.
It seems to me that we generally want to use the return address - 1
(well, ideally, the address of the `call' instruction, but we don't
have that) to decide which block any frame but the youngest is "in".
Would it make sense to create a new function --- `frame_calling_pc',
perhaps --- which encapsulates the logic in get_frame_block, and then
use that instead of `frame->pc' in get_frame_block and
block_innermost_frame?
Is there a better name? As you note, it isn't a valid PC (it may not
even point into an instruction!). Further, it is isn't the address of
the instruction ``calling'' the ``frame''. Last time this came up
address_in_block() was used - frame_address_in_block()?+ /* To evaluate if a given PC address is within a block range,
+ we normally check if PC is inside [block start .. block end[.
+ However, If FRAME is not the innermost frame, then frame->pc
+ normally points to the instruction *following* the call, which
+ means that the comparison with the block boundaries need to be
+ offset by one instruction. This is done by checking if PC is
+ inside ]block start .. block end] instead. */
+ innermost = !frame->next
+ || frame->next->signal_handler_caller
+ || frame_in_dummy (frame->next);
+ if ((innermost && frame->pc >= start && frame->pc < end)
+ || (!innermost && frame->pc > start && frame->pc <= end))
return frame;
Just BTW frame_in_dummy() isn't an indication of an innermost frame.
There can easily be other frames (and even dummy frames) more inner most
than that dummy frame.