Re: [PATCH] Clear current source symtab if belongs to objfile being freed

Jim Blandy
2006-01-03T23:26:19Z

On 1/3/06, Fred Fish <fnf@specifix.com> wrote:
> I stumbled over this problem while chasing something else. If the
> current source symtab belongs to a loaded shared library, and the
> objfile for that library is freed in the process or rerunning the
> executable, the current source symtab can be left pointing to garbage.
>
> An alternative solution, though a little more heavy handed, would be
> to replace the previous clear_pc_function_cache() call with a call to
> clear_symtab_users().
>
> Comments?

! /* I *think* all our callers call clear_symtab_users. If so, no
! need to call this here. Update: We are called via
! objfile_purge_solibs which doesn't call clear_symtab_users. */

I don't think we need our comments to be so archeological. If we
apply this patch, we should just change it to something direct like:

/* Not all our callers call clear_symtab_users
(objfile_purge_solibs, for example),
so we need to call this here. */

It seems to me, though, that the 'nosharedlibrary' and 'set
solib-absolute-prefix' commands actually ought to be calling
clear_symtab_users, no? I mean, types and blocks used by displays and
all those things are going to become invalidated, aren't they?