Re: [patch] Speed up find_pc_section

Pedro Alves
2009-07-22T10:46:26Z

On Tuesday 21 July 2009 21:18:26, Paul Pluzhnikov wrote:

> +
> +/* Set objfiles_updated_p so section map will be rebuilt next time it
> +   is used.  Called by executable_changed observer.  */
> +
> +static void
> +set_objfiles_updated_on_exe_change (void)
> +{
> +  objfiles_updated_p = 1;  /* Rebuild section map next time we need it.  */
> +}
> +
> +/* Set objfiles_updated_p so section map will be rebuilt next time it
> +   is used.  Called by solib_loaded/unloaded observer.  */
> +
> +static void
> +set_objfiles_updated_on_solib_activity (struct so_list *so_list)
> +{
> +  objfiles_updated_p = 1;  /* Rebuild section map next time we need it.  */
> +}
> +
> +void
> +_initialize_objfiles (void)
> +{
> +  observer_attach_executable_changed (set_objfiles_updated_on_exe_change);
> +  observer_attach_solib_loaded (set_objfiles_updated_on_solib_activity);
> +  observer_attach_solib_unloaded (set_objfiles_updated_on_solib_activity);
> +}

Are these observers sufficient? There are other sources of
objfiles !exec && !solibs. What about e.g., add-symbol-file? E.g.:

$ gdb
(gdb) add-symbol-file fooprogram 0x1234 (-s ... ... ...)
(gdb) p foosymbol

I don't think the map will be built, thus the section by pc won't
be found.

I'm also looking at objfile_relocate (from remote targets using
qOffsets for example), and wondering where is the map reset?

--
Pedro Alves