Re: [PATCH 3/8] Add support for non-contiguous blocks to find_pc_partial_function

Kevin Buettner
2018-08-01T23:40:43Z

On Tue, 31 Jul 2018 21:59:57 -0400
Simon Marchi <simon.marchi@ericsson.com> wrote:

> > int
> > find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
> > - CORE_ADDR *endaddr)
> > + CORE_ADDR *endaddr, const struct block **block)
> > {
> > struct obj_section *section;
> > struct symbol *f;
> > @@ -232,13 +223,37 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
> > f = find_pc_sect_function (mapped_pc, section);
> > if (f != NULL
> > && (msymbol.minsym == NULL
> > - || (BLOCK_START (SYMBOL_BLOCK_VALUE (f))
> > + || (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (f))
>
> I don't understand this change, can you explain it briefly?
>
> > >= BMSYMBOL_VALUE_ADDRESS (msymbol))))
> > {

A function's minimal symbol generally (maybe even always) refers to
the entry pc. Therefore, we want to compare the block's entry pc to
the minimal symbol address instead of the block start - which might
not be the same as the entry pc. BLOCK_START will refer to the lowest
address in all of the ranges.

I'll add a comment to the code explaining this.

Kevin