aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-11-08 23:12:52 +0000
committerAndrew Cagney <cagney@redhat.com>2002-11-08 23:12:52 +0000
commit8779790c2eedc1baa70047c61d1fdcb5033aa0d7 (patch)
tree1cf6e86c3ff1d6057f25f0ad836bd22fa27c58a7 /gdb
parent34f524690006a0420cb0edfc5464a9e95a18a130 (diff)
downloadgdb-8779790c2eedc1baa70047c61d1fdcb5033aa0d7.zip
gdb-8779790c2eedc1baa70047c61d1fdcb5033aa0d7.tar.gz
gdb-8779790c2eedc1baa70047c61d1fdcb5033aa0d7.tar.bz2
2002-11-08 Andrew Cagney <ac131313@redhat.com>
* frame.c (set_unwind_by_pc): Use dummy_frame_register_unwind. * dummy-frame.c (find_dummy_frame): Rename generic_find_dummy_frame, make static. Return the dummy frame instead of the regcache. (generic_find_dummy_frame): Re-implement using find_dummy_frame, (cached_find_dummy_frame): New function. Use find_dummy_frame. (dummy_frame_register_unwind): Rename generic_call_dummy_register_unwind. Use cached_find_dummy_frame. * dummy-frame.h (dummy_frame_register_unwind): Rename generic_call_dummy_register_unwind.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/dummy-frame.c56
-rw-r--r--gdb/dummy-frame.h17
-rw-r--r--gdb/frame.c2
4 files changed, 51 insertions, 37 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51b44a5..0c0fb1d6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2002-11-08 Andrew Cagney <ac131313@redhat.com>
+
+ * frame.c (set_unwind_by_pc): Use dummy_frame_register_unwind.
+ * dummy-frame.c (find_dummy_frame): Rename
+ generic_find_dummy_frame, make static. Return the dummy frame
+ instead of the regcache.
+ (generic_find_dummy_frame): Re-implement using find_dummy_frame,
+ (cached_find_dummy_frame): New function. Use find_dummy_frame.
+ (dummy_frame_register_unwind): Rename
+ generic_call_dummy_register_unwind. Use cached_find_dummy_frame.
+ * dummy-frame.h (dummy_frame_register_unwind): Rename
+ generic_call_dummy_register_unwind.
+
2002-11-08 Mark Kettenis <kettenis@gnu.org>
* config/i386/tm-i386v42mp.h: Remove file. Move its contents,
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 1a2a315..ddc4db8 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -58,8 +58,8 @@ static struct dummy_frame *dummy_frame_stack = NULL;
adjust for DECR_PC_AFTER_BREAK. This is because it is only legal
to call this function after the PC has been adjusted. */
-struct regcache *
-generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
+static struct dummy_frame *
+find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
{
struct dummy_frame *dummyframe;
@@ -94,10 +94,28 @@ generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
continue;
}
/* The FP matches this dummy frame. */
- return dummyframe->regcache;
+ return dummyframe;
}
- return 0;
+ return NULL;
+}
+
+struct dummy_frame *
+cached_find_dummy_frame (struct frame_info *frame, void **cache)
+{
+ if ((*cache) == NULL)
+ (*cache) = find_dummy_frame (frame->pc, frame->frame);
+ return (*cache);
+}
+
+struct regcache *
+generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
+{
+ struct dummy_frame *dummy = find_dummy_frame (pc, fp);
+ if (dummy != NULL)
+ return dummy->regcache;
+ else
+ return NULL;
}
char *
@@ -264,13 +282,13 @@ generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
register value is taken from the local copy of the register buffer. */
void
-generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
- int regnum, int *optimized,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnum, void *bufferp)
+dummy_frame_register_unwind (struct frame_info *frame, void **cache,
+ int regnum, int *optimized,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnum, void *bufferp)
{
- gdb_assert (frame != NULL);
- gdb_assert (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame));
+ struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache);
+ gdb_assert (dummy != NULL);
/* Describe the register's location. Generic dummy frames always
have the register value in an ``expression''. */
@@ -282,27 +300,11 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
/* If needed, find and return the value of the register. */
if (bufferp != NULL)
{
- struct regcache *registers;
-#if 1
- /* Get the address of the register buffer that contains all the
- saved registers for this dummy frame. Cache that address. */
- registers = (*cache);
- if (registers == NULL)
- {
- registers = generic_find_dummy_frame (frame->pc, frame->frame);
- (*cache) = registers;
- }
-#else
- /* Get the address of the register buffer that contains the
- saved registers and then extract the value from that. */
- registers = generic_find_dummy_frame (frame->pc, frame->frame);
-#endif
- gdb_assert (registers != NULL);
/* Return the actual value. */
/* Use the regcache_cooked_read() method so that it, on the fly,
constructs either a raw or pseudo register from the raw
register cache. */
- regcache_cooked_read (registers, regnum, bufferp);
+ regcache_cooked_read (dummy->regcache, regnum, bufferp);
}
}
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index 6bdebee..bd4e199 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -45,14 +45,14 @@ struct regcache;
/* Assuming that FRAME is a dummy, return a register value for the
previous frame. */
-extern void generic_call_dummy_register_unwind (struct frame_info *frame,
- void **unwind_cache,
- int regnum,
- int *optimized,
- enum lval_type *lvalp,
- CORE_ADDR *addrp,
- int *realnump,
- void *valuep);
+extern void dummy_frame_register_unwind (struct frame_info *frame,
+ void **unwind_cache,
+ int regnum,
+ int *optimized,
+ enum lval_type *lvalp,
+ CORE_ADDR *addrp,
+ int *realnump,
+ void *valuep);
/* Return the regcache that belongs to the dummy-frame identifed by PC
and FP, or NULL if no such frame exists. */
@@ -62,5 +62,4 @@ extern void generic_call_dummy_register_unwind (struct frame_info *frame,
extern struct regcache *generic_find_dummy_frame (CORE_ADDR pc,
CORE_ADDR fp);
-
#endif /* !defined (DUMMY_FRAME_H) */
diff --git a/gdb/frame.c b/gdb/frame.c
index c5b355f..9e31ad2 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -636,7 +636,7 @@ set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp,
return vaguely correct values.. */
*unwind = frame_saved_regs_register_unwind;
else if (PC_IN_CALL_DUMMY (pc, fp, fp))
- *unwind = generic_call_dummy_register_unwind;
+ *unwind = dummy_frame_register_unwind;
else
*unwind = frame_saved_regs_register_unwind;
}