diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1dc63567842..f259763a45d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-02-27 Philippe Waroquiers + + * target.c (target_detach): Clear the regcache and the + frame cache. + 2019-02-27 Pedro Alves * utils.c (set_screen_size): When we cap the height/width sizes, @@ -35,7 +40,7 @@ Python 2.4 workaround. 2019-02-27 Kevin Buettner - + * NEWS: Note minimum Python version. 2019-02-27 Kevin Buettner diff --git a/gdb/target.c b/gdb/target.c index 116510e8cb8..d5ff932c748 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2029,6 +2029,17 @@ target_detach (inferior *inf, int from_tty) prepare_for_detach (); current_top_target ()->detach (inf, from_tty); + + /* After we have detached, clear the register cache for this inferior. */ + ptid_t pid_ptid = ptid_t (inf->pid); + + registers_changed_ptid (pid_ptid); + + /* We have to ensure we have no frame cache left. Normally, + registers_changed_ptid (pid_ptid) calls reinit_frame_cache when + inferior_ptid matches pid_ptid, but in our case, it does not + call it, as inferior_ptid has been reset. */ + reinit_frame_cache (); } void