From: Daniel Jacobowitz Date: Wed, 28 Feb 2007 17:35:01 +0000 (+0000) Subject: * frame.c (frame_pop, frame_observer_target_changed): Call X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=35f196d907ec76a78167173efb1cdeedfcac93bf;p=deliverable%2Fbinutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 096d9be57c..250bc494b8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2007-02-28 Daniel Jacobowitz + + * 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 Joel Brobecker diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index a60204332a..864be4f451 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -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); } diff --git a/gdb/corelow.c b/gdb/corelow.c index 586ac69afe..267833e7b2 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -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 diff --git a/gdb/frame.c b/gdb/frame.c index ff8078bf26..a40bbb219c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -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). diff --git a/gdb/frame.h b/gdb/frame.h index 941ee73ef5..5181855564 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -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 diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 562897a72c..99f6ddf5fa 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -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); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index c776e28ad9..e65716cfb5 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -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); diff --git a/gdb/infrun.c b/gdb/infrun.c index 09467dbf52..5d03619930 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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. */ diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 6771784c34..0da442a993 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -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 (); diff --git a/gdb/ocd.c b/gdb/ocd.c index 5e72b10fd6..f52990088a 100644 --- 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); diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 4d94347f09..fea809df02 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -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); diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 4c6fdf8ea1..1f92f999f9 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -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); diff --git a/gdb/thread.c b/gdb/thread.c index a7a8617e38..3281988579 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -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 diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 3ad005f1ca..fb771d2223 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -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)