[commit] Fix reread_symbols crash (Re: [patch] Speed up find_pc_section)

Ulrich Weigand
2009-08-17T20:12:22Z

> 2009-07-22 Paul Pluzhnikov <ppluzhnikov@google.com>
>
> * objfiles.h (objfiles_changed): New prototype.
> * objfiles.c (objfiles_updated_p): Rename to objfiles_changed_p.
> (allocate_objfile, free_objfile): Must rebuild section map.
> (objfile_relocate): Likewise.
> (update_section_map, find_pc_section): Adjust.
> (set_objfiles_updated_on_exe_change): Remove.
> (set_objfiles_updated_on_solib_activity): Remove.
> (_initialize_objfiles): Remove.
> (objfiles_changed): New function.
> * symfile.c (reread_symbols): Call objfiles_changed.

This patch is causing crashes in reread.exp for me, because the stale
section list is accessed in breakpoint_re_set called from clear_symtab_users
called from reread_symbols *before* objfiles_changed is called.

Fixed by the following patch that calls objfiles_changed before
reread_symbols.

Tested on spu-elf; committed to mainline.

Bye,
Ulrich

ChangeLog:

* symfile.c (reread_symbols): Call objfiles_changed *before*
calling clear_symtab_users.

Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.242
diff -u -p -r1.242 symfile.c
--- gdb/symfile.c 14 Aug 2009 23:35:33 -0000 1.242
+++ gdb/symfile.c 17 Aug 2009 19:46:44 -0000
@@ -2467,13 +2467,13 @@ reread_symbols (void)

if (reread_one)
{
+ /* Notify objfiles that we've modified objfile sections. */
+ objfiles_changed ();
+
clear_symtab_users ();
/* At least one objfile has changed, so we can consider that
the executable we're debugging has changed too. */
observer_notify_executable_changed ();
-
- /* Notify objfiles that we've modified objfile sections. */
- objfiles_changed ();
}
}

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com