This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfc] Eliminate set_current_frame()
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 11 Dec 2002 18:24:45 -0500
- Subject: [patch/rfc] Eliminate set_current_frame()
Hello,
Finally, this eliminates the function set_current_frame() from
frame.[hc]. One less bit of nastiness removed :-)
I'll commit in a few days,
Andrew
2002-12-11 Andrew Cagney <ac131313@redhat.com>
* infcmd.c (run_stack_dummy): Create a frame ID directly and then
pass that to set_momentary_breakpoint.
* frame.h (set_current_frame): Delete declaration.
* frame.c (set_current_frame): Delete function.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.41
diff -u -r1.41 frame.c
--- frame.c 11 Dec 2002 20:35:42 -0000 1.41
+++ frame.c 11 Dec 2002 22:44:53 -0000
@@ -472,12 +472,6 @@
return current_frame;
}
-void
-set_current_frame (struct frame_info *frame)
-{
- current_frame = frame;
-}
-
/* The "selected" stack frame is used by default for local and arg
access. May be zero, for no selected frame. */
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.45
diff -u -r1.45 frame.h
--- frame.h 11 Dec 2002 20:35:43 -0000 1.45
+++ frame.h 11 Dec 2002 22:44:53 -0000
@@ -625,22 +625,8 @@
extern struct frame_info *deprecated_selected_frame;
-/* NOTE: cagney/2002-11-28:
+/* Create a frame using the specified BASE and PC. */
- These functions are used to explicitly create and set the inner
- most (current) frame vis:
-
- set_current_frame (create_new_frame (read_fp(), stop_pc)));
-
- Such code should be removed. Instead that task can be left to
- get_current_frame() which will update things on-demand.
-
- The only vague exception is found in "infcmd.c" (and a few
- architectures specific files) as part of the code implementing the
- command ``(gdb) frame FRAME PC''. There, the frame should be
- created/selected in a single shot. */
-
-extern void set_current_frame (struct frame_info *);
-extern struct frame_info *create_new_frame (CORE_ADDR, CORE_ADDR);
+extern struct frame_info *create_new_frame (CORE_ADDR base, CORE_ADDR pc);
#endif /* !defined (FRAME_H) */
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.68
diff -u -r1.68 infcmd.c
--- infcmd.c 11 Dec 2002 22:34:47 -0000 1.68
+++ infcmd.c 11 Dec 2002 22:44:53 -0000
@@ -1001,30 +1001,28 @@
}
else
{
+ /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need
+ to put a breakpoint instruction. If not, the call dummy
+ already has the breakpoint instruction in it.
+
+ ADDR IS THE ADDRESS of the call dummy plus the
+ CALL_DUMMY_START_OFFSET, so we need to subtract the
+ CALL_DUMMY_START_OFFSET. */
sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
}
sal.section = find_pc_overlay (sal.pc);
- /* Set up a FRAME for the dummy frame so we can pass it to
- set_momentary_breakpoint. We need to give the breakpoint a
- frame in case there is only one copy of the dummy (e.g.
- CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
- flush_cached_frames ();
- set_current_frame (create_new_frame (read_fp (), sal.pc));
-
- /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
- a breakpoint instruction. If not, the call dummy already has the
- breakpoint instruction in it.
-
- addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
- so we need to subtract the CALL_DUMMY_START_OFFSET. */
- /* FIXME: cagney/2002-12-01: Rather than pass in curent frame,
- why not just create, and then pass in a frame ID. This would
- make it possible to eliminate set_current_frame(). */
- bpt = set_momentary_breakpoint (sal,
- get_frame_id (get_current_frame ()),
- bp_call_dummy);
- bpt->disposition = disp_del;
+ {
+ /* Set up a frame ID for the dummy frame so we can pass it to
+ set_momentary_breakpoint. We need to give the breakpoint a
+ frame ID so that the breakpoint code can correctly
+ re-identify the dummy breakpoint. */
+ struct frame_id frame = frame_id_build (read_fp (), sal.pc);
+ /* Create a momentary breakpoint at the return address of the
+ inferior. That way it breaks when it returns. */
+ bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
+ bpt->disposition = disp_del;
+ }
/* If all error()s out of proceed ended up calling normal_stop (and
perhaps they should; it already does in the special case of error