Overlay support broken (Re: [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap))

Ulrich Weigand
2008-05-12T19:46:42Z

Jan Kratochvil wrote:

> * symtab.c: Include "addrmap.h"
> (find_pc_sect_psymtab): Support reading the field PSYMTABS_ADDRMAP.
> Move the psymtab locator into ...
> (find_pc_sect_psymtab_closer): ... a new function.

It appears this change broke overlay support. In fact, it looks like the
main idea of this patch is fundamentally incompatible with overlays:

> + /* Map addresses to the entries of PSYMTABS. It would be more efficient to
> + have a map per the whole process but ADDRMAP cannot selectively remove
> + its items during FREE_OBJFILE. This mapping is already present even for
> + PARTIAL_SYMTABs which still have no corresponding full SYMTABs read. */
> +
> + struct addrmap *psymtabs_addrmap;

In the presence of overlays, a single address can map to *multiple* PSYMTABS
corresponding to multiple overlay segments optionally loaded at that address.

The old code chose between them using the "section" argument to
find_pc_sect_psymtab; it seems the new code just ignores this argument:

/* Try just the PSYMTABS_ADDRMAP mapping first as it has better granularity
than the later used TEXTLOW/TEXTHIGH one. */

ALL_OBJFILES (objfile)
if (objfile->psymtabs_addrmap != NULL)
{
struct partial_symtab *pst;

pst = addrmap_find (objfile->psymtabs_addrmap, pc);
if (pst != NULL)
{
/* We do not try to call FIND_PC_SECT_PSYMTAB_CLOSER as
PSYMTABS_ADDRMAP we used has already the best 1-byte
granularity and FIND_PC_SECT_PSYMTAB_CLOSER may mislead us into
a worse chosen section due to the TEXTLOW/TEXTHIGH ranges
overlap. */

return pst;
}
}

Any suggestions how to fix this?

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com