Re: [patch] Speed up find_pc_section

Paul Pluzhnikov
2009-07-22T17:16:21Z

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

On Wed, Jul 22, 2009 at 9:32 AM, Pedro Alves<pedro@codesourcery.com> wrote:

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

I think it's pretty clear that what I really need is a new 'remove_objfile'
kind of observer.

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

This would be handled by the 'remove_objfile' observer, I think.

> Given the new_objfile observer, do we still need the exec_changed and
> solib observers?

No, I've removed that (new patch attached).

> 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.

I think new_objfile/remove_objfile will take care of any of these.

Should I revert the find_pc_section patch, work up remove_objfile observer
patch, then re-apply find_pc_section patch once it's in better shape?

Thanks,
--
Paul Pluzhnikov

2009-07-22 Paul Pluzhnikov <ppluzhnikov@google.com>

* objfiles.c (objfile_relocate): Must rebuild section map.
(set_objfiles_updated_on_exe_change): Remove.
(set_objfiles_updated_on_new_objfile): New observer.
(_initialize_objfiles): Adjust.

[-- Attachment #2: gdb-find_pc_section-20090722-2.txt --]
[-- Type: text/plain, Size: 1859 bytes --]

Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.86
diff -u -p -u -r1.86 objfiles.c
--- objfiles.c 21 Jul 2009 20:54:30 -0000 1.86
+++ objfiles.c 22 Jul 2009 17:12:52 -0000
@@ -682,6 +682,7 @@ objfile_relocate (struct objfile *objfil

/* Relocate breakpoints as necessary, after things are relocated. */
breakpoint_re_set ();
+ objfiles_updated_p = 1; /* Rebuild section map next time we need it. */
}
\f
/* Many places in gdb want to test just to see if we have any partial
@@ -990,19 +991,19 @@ objfile_data (struct objfile *objfile, c
}

/* Set objfiles_updated_p so section map will be rebuilt next time it
- is used. Called by executable_changed observer. */
+ is used. Called by solib_loaded/unloaded observer. */

static void
-set_objfiles_updated_on_exe_change (void)
+set_objfiles_updated_on_solib_activity (struct so_list *so_list)
{
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. */
+ is used. Called by new_objfile observer. */

static void
-set_objfiles_updated_on_solib_activity (struct so_list *so_list)
+set_objfiles_updated_on_new_objfile (struct objfile *objfile)
{
objfiles_updated_p = 1; /* Rebuild section map next time we need it. */
}
@@ -1010,7 +1011,7 @@ set_objfiles_updated_on_solib_activity (
void
_initialize_objfiles (void)
{
- observer_attach_executable_changed (set_objfiles_updated_on_exe_change);
+ observer_attach_new_objfile (set_objfiles_updated_on_new_objfile);
observer_attach_solib_loaded (set_objfiles_updated_on_solib_activity);
observer_attach_solib_unloaded (set_objfiles_updated_on_solib_activity);
}