* frame.c (frame_pop, frame_observer_target_changed): Call
authorDaniel Jacobowitz <drow@false.org>
Wed, 28 Feb 2007 17:35:01 +0000 (17:35 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 28 Feb 2007 17:35:01 +0000 (17:35 +0000)
reinit_frame_cache.
(flush_cached_frames): Rename to reinit_frame_cache and delete
old implementation.
* frame.h (flush_cached_frames): Delete prototype and update comment.

* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Call
reinit_frame_cache instead of flush_cached_frames.  Do not call
select_frame after reinit_frame_cache.
* corelow.c (core_open): Likewise.
* gdbarch.sh (deprecated_current_gdbarch_select_hack): Likewise.
* infrun.c (prepare_to_proceed, context_switch)
(handle_inferior_event): Likewise.
* linux-fork.c (fork_load_infrun_state): Likewise.
* ocd.c (ocd_start_remote): Likewise.
* remote-e7000.c (e7000_start_remote): Likewise.
* remote-mips.c (device): Likewise.
* thread.c (switch_to_thread): Likewise.
* tracepoint.c (finish_tfind_command): Likewise.
* gdbarch.c: Regenerated.

14 files changed:
gdb/ChangeLog
gdb/bsd-kvm.c
gdb/corelow.c
gdb/frame.c
gdb/frame.h
gdb/gdbarch.c
gdb/gdbarch.sh
gdb/infrun.c
gdb/linux-fork.c
gdb/ocd.c
gdb/remote-e7000.c
gdb/remote-mips.c
gdb/thread.c
gdb/tracepoint.c

index 096d9be..250bc49 100644 (file)
@@ -1,3 +1,26 @@
+2007-02-28  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * frame.c (frame_pop, frame_observer_target_changed): Call
+       reinit_frame_cache.
+       (flush_cached_frames): Rename to reinit_frame_cache and delete
+       old implementation.
+       * frame.h (flush_cached_frames): Delete prototype and update comment.
+
+       * bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Call
+       reinit_frame_cache instead of flush_cached_frames.  Do not call
+       select_frame after reinit_frame_cache.
+       * corelow.c (core_open): Likewise.
+       * gdbarch.sh (deprecated_current_gdbarch_select_hack): Likewise.
+       * infrun.c (prepare_to_proceed, context_switch)
+       (handle_inferior_event): Likewise.
+       * linux-fork.c (fork_load_infrun_state): Likewise.
+       * ocd.c (ocd_start_remote): Likewise.
+       * remote-e7000.c (e7000_start_remote): Likewise.
+       * remote-mips.c (device): Likewise.
+       * thread.c (switch_to_thread): Likewise.
+       * tracepoint.c (finish_tfind_command): Likewise.
+       * gdbarch.c: Regenerated.
+
 2007-02-28  Jerome Guitton  <guitton@adacore.com>
             Joel Brobecker  <brobecker@adacore.com>
 
index a602043..864be4f 100644 (file)
@@ -93,8 +93,7 @@ bsd_kvm_open (char *filename, int from_tty)
 
   target_fetch_registers (-1);
 
-  flush_cached_frames ();
-  select_frame (get_current_frame ());
+  reinit_frame_cache ();
   print_stack_frame (get_selected_frame (NULL), -1, 1);
 }
 
@@ -276,8 +275,7 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
 
   target_fetch_registers (-1);
 
-  flush_cached_frames ();
-  select_frame (get_current_frame ());
+  reinit_frame_cache ();
   print_stack_frame (get_selected_frame (NULL), -1, 1);
 }
 
@@ -297,8 +295,7 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
 
   target_fetch_registers (-1);
 
-  flush_cached_frames ();
-  select_frame (get_current_frame ());
+  reinit_frame_cache ();
   print_stack_frame (get_selected_frame (NULL), -1, 1);
 }
 
index 586ac69..267833e 100644 (file)
@@ -378,8 +378,7 @@ core_open (char *filename, int from_tty)
       target_fetch_registers (-1);
 
       /* Now, set up the frame cache, and print the top of stack.  */
-      flush_cached_frames ();
-      select_frame (get_current_frame ());
+      reinit_frame_cache ();
       print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
     }
   else
index ff8078b..a40bbb2 100644 (file)
@@ -537,7 +537,7 @@ frame_pop (struct frame_info *this_frame)
 
   /* We've made right mess of GDB's local state, just discard
      everything.  */
-  flush_cached_frames ();
+  reinit_frame_cache ();
 }
 
 void
@@ -1070,13 +1070,13 @@ get_next_frame (struct frame_info *this_frame)
 void
 frame_observer_target_changed (struct target_ops *target)
 {
-  flush_cached_frames ();
+  reinit_frame_cache ();
 }
 
 /* Flush the entire frame cache.  */
 
 void
-flush_cached_frames (void)
+reinit_frame_cache (void)
 {
   /* Since we can't really be sure what the first object allocated was */
   obstack_free (&frame_cache_obstack, 0);
@@ -1086,21 +1086,7 @@ flush_cached_frames (void)
   select_frame (NULL);
   annotate_frames_invalid ();
   if (frame_debug)
-    fprintf_unfiltered (gdb_stdlog, "{ flush_cached_frames () }\n");
-}
-
-/* Flush the frame cache, and start a new one if necessary.  */
-
-void
-reinit_frame_cache (void)
-{
-  flush_cached_frames ();
-
-  /* FIXME: The inferior_ptid test is wrong if there is a corefile.  */
-  if (PIDGET (inferior_ptid) != 0)
-    {
-      select_frame (get_current_frame ());
-    }
+    fprintf_unfiltered (gdb_stdlog, "{ reinit_frame_cache () }\n");
 }
 
 /* Find where a register is saved (in memory or another register).
index 941ee73..5181855 100644 (file)
@@ -225,17 +225,10 @@ extern struct frame_info *get_current_frame (void);
 /* Invalidates the frame cache (this function should have been called
    invalidate_cached_frames).
 
-   FIXME: cagney/2002-11-28: The only difference between
-   flush_cached_frames() and reinit_frame_cache() is that the latter
-   explicitly sets the selected frame back to the current frame -- there
-   isn't any real difference (except that one delays the selection of
-   a new frame).  Code can instead simply rely on get_selected_frame()
-   to reinit the selected frame as needed.  As for invalidating the
-   cache, there should be two methods: one that reverts the thread's
-   selected frame back to current frame (for when the inferior
-   resumes) and one that does not (for when the user modifies the
-   target invalidating the frame cache).  */
-extern void flush_cached_frames (void);
+   FIXME: cagney/2002-11-28: There should be two methods: one that
+   reverts the thread's selected frame back to current frame (for when
+   the inferior resumes) and one that does not (for when the user
+   modifies the target invalidating the frame cache).  */
 extern void reinit_frame_cache (void);
 
 /* On demand, create the selected frame and then return it.  If the
index 562897a..99f6ddf 100644 (file)
@@ -4202,7 +4202,7 @@ deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
   current_gdbarch_swap_out_hack ();
   current_gdbarch_swap_in_hack (new_gdbarch);
   architecture_changed_event ();
-  flush_cached_frames ();
+  reinit_frame_cache ();
 }
 
 extern void _initialize_gdbarch (void);
index c776e28..e65716c 100755 (executable)
@@ -2241,7 +2241,7 @@ deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
   current_gdbarch_swap_out_hack ();
   current_gdbarch_swap_in_hack (new_gdbarch);
   architecture_changed_event ();
-  flush_cached_frames ();
+  reinit_frame_cache ();
 }
 
 extern void _initialize_gdbarch (void);
index 09467db..5d03619 100644 (file)
@@ -686,10 +686,9 @@ prepare_to_proceed (void)
 
          /* FIXME: This stuff came from switch_to_thread() in
             thread.c (which should probably be a public function).  */
-         flush_cached_frames ();
+         reinit_frame_cache ();
          registers_changed ();
          stop_pc = wait_pc;
-         select_frame (get_current_frame ());
        }
 
       /* We return 1 to indicate that there is a breakpoint here,
@@ -1157,7 +1156,7 @@ context_switch (struct execution_control_state *ecs)
                         &ecs->current_line, &ecs->current_symtab);
     }
   inferior_ptid = ecs->ptid;
-  flush_cached_frames ();
+  reinit_frame_cache ();
 }
 
 static void
@@ -1304,7 +1303,7 @@ handle_inferior_event (struct execution_control_state *ecs)
     }
   ecs->infwait_state = infwait_normal_state;
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
 
   /* If it's a new process, add it to the thread database */
 
@@ -1429,7 +1428,7 @@ handle_inferior_event (struct execution_control_state *ecs)
       if (!ptid_equal (ecs->ptid, inferior_ptid))
        {
          context_switch (ecs);
-         flush_cached_frames ();
+         reinit_frame_cache ();
        }
 
       stop_pc = read_pc ();
@@ -1490,7 +1489,7 @@ handle_inferior_event (struct execution_control_state *ecs)
       if (!ptid_equal (ecs->ptid, inferior_ptid))
        {
          context_switch (ecs);
-         flush_cached_frames ();
+         reinit_frame_cache ();
        }
 
       /* If no catchpoint triggered for this, then keep going.  */
index 6771784..0da442a 100644 (file)
@@ -250,10 +250,6 @@ fork_load_infrun_state (struct fork_info *fp)
   registers_changed ();
   reinit_frame_cache ();
 
-  /* We must select a new frame before making any inferior calls to
-     avoid warnings.  */
-  select_frame (get_current_frame ());
-
   stop_pc = read_pc ();
   nullify_last_target_wait_ptid ();
 
index 5e72b10..f529900 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -223,7 +223,7 @@ ocd_start_remote (void *dummy)
    doesn't happen here (in fact, it may not be possible to get the monitor to
    send the appropriate packet).  */
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
   stop_pc = read_pc ();
   print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
index 4d94347..fea809d 100644 (file)
@@ -628,7 +628,7 @@ e7000_start_remote (void *dummy)
    that the target is about to print out a status message of some sort.  That
    doesn't happen here. */
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
   stop_pc = read_pc ();
   print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
index 4c6fdf8..1f92f99 100644 (file)
@@ -1584,7 +1584,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
      of some sort.  That doesn't happen here (in fact, it may not be
      possible to get the monitor to send the appropriate packet).  */
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
   stop_pc = read_pc ();
   print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
index a7a8617..3281988 100644 (file)
@@ -461,10 +461,9 @@ switch_to_thread (ptid_t ptid)
     return;
 
   inferior_ptid = ptid;
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
   stop_pc = read_pc ();
-  select_frame (get_current_frame ());
 }
 
 static void
index 3ad005f..fb771d2 100644 (file)
@@ -1969,9 +1969,8 @@ finish_tfind_command (char **msg,
        error (_("Bogus reply from target: %s"), reply);
       }
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
-  select_frame (get_current_frame ());
   set_traceframe_num (target_frameno);
   set_tracepoint_num (target_tracept);
   if (target_frameno == -1)