summaryrefslogtreecommitdiff
path: root/gdb/dummy-frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-08-02 17:39:53 +0000
committerAndrew Cagney <cagney@redhat.com>2004-08-02 17:39:53 +0000
commitfc08a0b0d3f7a462bbb1ee70adf6099937e10462 (patch)
tree67378385241231d2b3b6b98f49bf355181749039 /gdb/dummy-frame.c
parent2d545ab287c63f388438b03810b6850baffae7f4 (diff)
downloadgdb-fc08a0b0d3f7a462bbb1ee70adf6099937e10462.tar.gz
2004-08-02 Andrew Cagney <cagney@gnu.org>
* dummy-frame.c: Include "gdb_string.h". (generic_save_call_dummy_addr, generic_push_dummy_frame) (generic_save_dummy_frame_tos): Delete. (dummy_frame_push): New function, replaces above. * dummy-frame.h: Update copyright. (dummy_frame_push): Declare. * frame.h (generic_save_dummy_frame_tos, generic_push_dummy_frame) (generic_save_call_dummy_addr): Delete declarations. * infcall.c: Include "dummy-frame.h". (call_function_by_hand): Add locals caller_regcache, caller_regcache_cleanup and dummy_id. Replace push_dummy_frame with call to frame_save_as_regcache plus cleanup. Delete calls to generic_save_call_dummy_addr and generic_save_dummy_frame_tos. Move clear_proceed_status to just before the resume, add call to dummy_frame_push (discard cleanup). * Makefile.in (infcall.o): Add $(dummy_frame_h). (dummy-frame.o): Add $(gdb_string_h).
Diffstat (limited to 'gdb/dummy-frame.c')
-rw-r--r--gdb/dummy-frame.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 1945a00d966..53365f41699 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -31,6 +31,7 @@
#include "frame-unwind.h"
#include "command.h"
#include "gdbcmd.h"
+#include "gdb_string.h"
static int pc_in_dummy_frame (CORE_ADDR pc);
@@ -94,27 +95,24 @@ pc_in_dummy_frame (CORE_ADDR pc)
return 0;
}
-/* Save all the registers on the dummy frame stack. Most ports save the
- registers on the target stack. This results in lots of unnecessary memory
- references, which are slow when debugging via a serial line. Instead, we
- save all the registers internally, and never write them to the stack. The
- registers get restored when the called function returns to the entry point,
- where a breakpoint is laying in wait. */
+/* Push the caller's state, along with the dummy frame info, onto a
+ dummy-frame stack. */
void
-generic_push_dummy_frame (void)
+dummy_frame_push (struct regcache *caller_regcache,
+ const struct frame_id *dummy_id)
{
struct dummy_frame *dummy_frame;
- CORE_ADDR fp = get_frame_base (get_current_frame ());
-
- /* check to see if there are stale dummy frames,
- perhaps left over from when a longjump took us out of a
- function that was called by the debugger */
+ /* Check to see if there are stale dummy frames, perhaps left over
+ from when a longjump took us out of a function that was called by
+ the debugger. */
dummy_frame = dummy_frame_stack;
while (dummy_frame)
- if (gdbarch_inner_than (current_gdbarch, dummy_frame->top, fp))
- /* stale -- destroy! */
+ /* FIXME: cagney/2004-08-02: Should just test IDs. */
+ if (gdbarch_inner_than (current_gdbarch, dummy_frame->top,
+ dummy_id->stack_addr))
+ /* Stale -- destroy! */
{
dummy_frame_stack = dummy_frame->next;
regcache_xfree (dummy_frame->regcache);
@@ -124,31 +122,19 @@ generic_push_dummy_frame (void)
else
dummy_frame = dummy_frame->next;
- dummy_frame = xmalloc (sizeof (struct dummy_frame));
- dummy_frame->regcache = frame_save_as_regcache (get_current_frame ());
-
- dummy_frame->pc = read_pc ();
- dummy_frame->top = 0;
- dummy_frame->id = get_frame_id (get_current_frame ());
+ dummy_frame = XZALLOC (struct dummy_frame);
+ dummy_frame->regcache = caller_regcache;
+ dummy_frame->id = (*dummy_id);
+ /* FIXME: cagney/2004-08-02: Retain for compatibility - trust the
+ ID. */
+ dummy_frame->pc = dummy_id->code_addr;
+ dummy_frame->top = dummy_id->stack_addr;
+ dummy_frame->call_lo = dummy_id->code_addr + 0;
+ dummy_frame->call_hi = dummy_id->code_addr + 1;
dummy_frame->next = dummy_frame_stack;
dummy_frame_stack = dummy_frame;
}
-void
-generic_save_dummy_frame_tos (CORE_ADDR sp)
-{
- dummy_frame_stack->top = sp;
-}
-
-/* Record the upper/lower bounds on the address of the call dummy. */
-
-void
-generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi)
-{
- dummy_frame_stack->call_lo = lo;
- dummy_frame_stack->call_hi = hi;
-}
-
/* Return the dummy frame cache, it contains both the ID, and a
pointer to the regcache. */
struct dummy_frame_cache