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

Fred Fish
2006-01-04T20:57:38Z

On Tuesday 03 January 2006 18:26, Jim Blandy wrote:
> 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?

I tried the following patch but it broke a bunch of stuff in the testsuite.

*** objfiles.c 30 Dec 2005 18:53:15 -0000 1.1.1.2
--- objfiles.c 4 Jan 2006 19:11:32 -0000
*************** objfile_purge_solibs (void)
*** 689,694 ****
--- 689,695 ----
struct objfile *objf;
struct objfile *temp;

+ clear_symtab_users ();
ALL_OBJFILES_SAFE (objf, temp)
{
/* We assume that the solib package has been purged already, or will

I've not investigated all the failures, but I suppose it's reasonable to
assume that this is overkill. What if there is a lot of debugging state
set up, none of which references the discarded objfile, and we expect
it to still be set up after discarding the objfile?

The patch I submitted is pretty minimalist in what it affects, only
discarding a reference that gdb knows to be invalidated. Perhaps there
will be others, but they should probably be dealt with as they are
discovered.

It might be a good idea though to put in some testsuite tests that
specifically check some of the other operations you suspect could
also be affected.

-Fred