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]

flush register/frame caches when loading a new core.


With some local changes on top, I've noticed a latent problem
when loading core files.  There are register reads as soon as the
post_create_inferior call just a bit below.  Due to some
breakpoint re-setting local changes, I ended up having current/selected-frame
reads from inside post_create_inferior, resulting in dwarf2-frame
assertions, due to stale frame cache info from the previous core I
had loaded.

This shouldn't do any harm, so I've checked it in for now.
(There's possibly other places with the same issue, and
perhaps there's a more central place we could do
this (perhaps post_create_inferior could be one such place?).
We'll see.

-- 
Pedro Alves

2009-05-18  Pedro Alves  <pedro@codesourcery.com>

	* corelow.c (core_open): Flush the register cache before doing
	anything with registers.

---
 gdb/corelow.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: src/gdb/corelow.c
===================================================================
--- src.orig/gdb/corelow.c	2009-02-23 00:03:48.000000000 +0000
+++ src/gdb/corelow.c	2009-05-18 13:10:37.000000000 +0100
@@ -379,6 +379,14 @@ core_open (char *filename, int from_tty)
      from ST to MT.  */
   add_thread_silent (inferior_ptid);
 
+  /* Need to flush the register cache (and the frame cache) from a
+     previous debug session.  If inferior_ptid ends up the same as the
+     last debug session --- e.g., b foo; run; gcore core1; step; gcore
+     core2; core core1; core core2 --- then there's potential for
+     get_current_regcache to return the cached regcache of the
+     previous session, and the frame cache being stale.  */
+  registers_changed ();
+
   /* Build up thread list from BFD sections, and possibly set the
      current thread to the .reg/NN section matching the .reg
      section. */


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