From 739fc47ac9a6169d7b12e82a3ec6ce8472354f78 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 18 May 2009 12:12:16 +0000 Subject: [PATCH] * corelow.c (core_open): Flush the register cache before doing anything with registers. --- gdb/ChangeLog | 5 +++++ gdb/corelow.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a99b111789..ecfe85adca6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-05-18 Pedro Alves + + * corelow.c (core_open): Flush the register cache before doing + anything with registers. + 2009-05-18 Pedro Alves * inflow.h (our_process_group): Remove declaration. diff --git a/gdb/corelow.c b/gdb/corelow.c index 5d6f0726150..ffaf04c93ae 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -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. */ -- 2.30.2