This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PR 21337 v2: segfault when re-reading symbols with remote debugging.
I updated and rebased the patch per Luis's comments in:
https://www.sourceware.org/ml/gdb-patches/2017-04/msg00361.html
which I attached. Could a global maintainer review it when they have
the chance? The problem is only exposed on MIPS, however the patch
involves changing code that is not MIPS specific.
Thanks,
Doug
gdb/
2017-??-?? Doug Gilmore <Doug.Gilmore@Doug.Gilmore@imgtec.com>
* symfile.c (reread_symbols): Fix PR 21337.
---
gdb/symfile.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 846aabe..d57563d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2576,6 +2576,12 @@ reread_symbols (void)
/* Free the obstacks for non-reusable objfiles. */
psymbol_bcache_free (objfile->psymbol_cache);
objfile->psymbol_cache = psymbol_bcache_init ();
+
+ /* Notify objfiles that we've modified objfile sections, which now
+ needs to be done early to ensure that, for the MIPS target,
+ find_pc_section won't access stale data. */
+ objfiles_changed ();
+
obstack_free (&objfile->objfile_obstack, 0);
objfile->sections = NULL;
objfile->compunit_symtabs = NULL;
@@ -2660,9 +2666,6 @@ reread_symbols (void)
if (!new_objfiles.empty ())
{
- /* Notify objfiles that we've modified objfile sections. */
- objfiles_changed ();
-
clear_symtab_users (0);
/* clear_objfile_data for each objfile was called before freeing it and
--
1.9.1