This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [mips] Fix PR 21337 v1: segfault when re-reading symbols with remote debugging.


This is a fix to a problem that was introduced with commit g3e29f34.

OK to apply?

Doug
>From 6746b67149f1158c072317e0f1a095d682e112aa Mon Sep 17 00:00:00 2001
From: Doug Gilmore <doug.gilmore@imgtec.com>
Date: Fri, 31 Mar 2017 15:41:06 -0700
Subject: [PATCH] [mips] Fix PR 21337 v1: segfault when re-reading symbols with
 remote debugging.

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 8b79508..290b18b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2592,6 +2592,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.  PR 21337.  */
+	  objfiles_changed ();
+
 	  obstack_free (&objfile->objfile_obstack, 0);
 	  objfile->sections = NULL;
 	  objfile->compunit_symtabs = NULL;
@@ -2678,9 +2684,6 @@ reread_symbols (void)
     {
       int ix;
 
-      /* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]