Re: [patch] Speed up find_pc_section

Pedro Alves
2009-07-22T16:33:20Z

On Wednesday 22 July 2009 16:49:39, Paul Pluzhnikov wrote:
> On Wed, Jul 22, 2009 at 7:25 AM, Tom Tromey<tromey@redhat.com> wrote:
>
> > Paul, could you please either fix this ASAP, or revert the change while
> > coming up with a fix?  Thanks.
>
> Here is the fix for both issues.
> Tested on Linux/x86_64, no regressions.
>
> I'll work up a test case for add-symbol-file in a separate patch.
> Not sure if I can make a test case for objfile_relocate though.
>
> Thanks,

Thanks, this looks better, but, there are a few issues I'd like to point out.

solib.c:

/* Notify any observer that the shared object has been
unloaded before we remove it from GDB's tables. */
observer_notify_solib_unloaded (gdb);

*gdb_link = gdb->next;

/* Unless the user loaded it explicitly, free SO's objfile. */
if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED))
free_objfile (gdb->objfile);

In the OBJF_USERLOADED case, you rebuild the map when you don't
really need to.

You're also likely breaking xcoffsolib.c and the vmap code in exec.c, as
it calls free_objfile without going through observers.

Given the new_objfile observer, do we still need the exec_changed and
solib observers? It sounds strange to me that this objfiles.c private
cache needs observers from *other* modules.

Please look around and check that objfile->section_offsets or
obj_section_offset isn't being used as an lvalue somewhere where
the map cache isn't being flushed.

--
Pedro Alves