This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[comit] Return unwound ID using a parameter
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 16 Jan 2003 11:18:24 -0500
- Subject: [comit] Return unwound ID using a parameter
Hello,
This modifies slightly the underlying frame ID unwind method so that the
ID is returned as a parameter instead of a function. It is to simplify
the include dependencies of a follow-on patch.
committed,
Andrew
2003-01-16 Andrew Cagney <ac131313@redhat.com>
* frame.h (frame_id_unwind_ftype): Change type so that the frame's
ID back using a parameter.
* frame.c (frame_id_unwind): Update call.
(frame_saved_regs_id_unwind): Update.
* dummy-frame.c (dummy_frame_id_unwind): Update function.
* dummy-frame.h (struct frame_id): Add opaque declaration.
(dummy_frame_id_unwind): Update declaration.
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.7
diff -u -r1.7 dummy-frame.c
--- dummy-frame.c 13 Dec 2002 16:40:25 -0000 1.7
+++ dummy-frame.c 16 Jan 2003 16:02:50 -0000
@@ -345,16 +345,17 @@
}
-struct frame_id
-dummy_frame_id_unwind (struct frame_info *frame,
- void **cache)
+void
+dummy_frame_id_unwind (struct frame_info *frame, void **cache,
+ struct frame_id *id)
{
struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache);
/* Oops! In a dummy-frame but can't find the stack dummy. Pretend
that the frame doesn't unwind. Should this function instead
return a has-no-caller indication? */
if (dummy == NULL)
- return null_frame_id;
- return dummy->id;
+ (*id) = null_frame_id;
+ else
+ (*id) = dummy->id;
}
Index: dummy-frame.h
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.h,v
retrieving revision 1.5
diff -u -r1.5 dummy-frame.h
--- dummy-frame.h 13 Dec 2002 16:40:25 -0000 1.5
+++ dummy-frame.h 16 Jan 2003 16:02:50 -0000
@@ -24,6 +24,7 @@
struct frame_info;
struct regcache;
+struct frame_id;
/* GENERIC DUMMY FRAMES
@@ -63,8 +64,9 @@
/* Assuming that FRAME is a dummy, return the ID of the calling frame
(the frame that the dummy has the saved state of). */
-extern struct frame_id dummy_frame_id_unwind (struct frame_info *frame,
- void **unwind_cache);
+extern void dummy_frame_id_unwind (struct frame_info *frame,
+ void **unwind_cache,
+ struct frame_id *id);
/* Does the PC fall in a dummy frame?
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.57
diff -u -r1.57 frame.c
--- frame.c 13 Jan 2003 21:10:29 -0000 1.57
+++ frame.c 16 Jan 2003 16:02:51 -0000
@@ -138,8 +138,7 @@
{
if (!frame->id_unwind_cache_p)
{
- frame->id_unwind_cache =
- frame->id_unwind (frame, &frame->unwind_cache);
+ frame->id_unwind (frame, &frame->unwind_cache, &frame->id_unwind_cache);
frame->id_unwind_cache_p = 1;
}
return frame->id_unwind_cache;
@@ -655,11 +654,16 @@
return FRAME_SAVED_PC (frame);
}
-static struct frame_id
-frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache)
+static void
+frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache,
+ struct frame_id *id)
{
int fromleaf;
- struct frame_id id;
+ CORE_ADDR base;
+ CORE_ADDR pc;
+
+ /* Start out by assuming it's NULL. */
+ (*id) = null_frame_id;
if (next_frame->next == NULL)
/* FIXME: 2002-11-09: Frameless functions can occure anywhere in
@@ -677,7 +681,7 @@
/* FIXME: 2002-11-09: There isn't any reason to special case this
edge condition. Instead the per-architecture code should hande
it locally. */
- id.base = get_frame_base (next_frame);
+ base = get_frame_base (next_frame);
else
{
/* Two macros defined in tm.h specify the machine-dependent
@@ -695,18 +699,19 @@
this to after the ffi test; I'd rather have backtraces from
start go curfluy than have an abort called from main not show
main. */
- id.base = FRAME_CHAIN (next_frame);
+ base = FRAME_CHAIN (next_frame);
- if (!frame_chain_valid (id.base, next_frame))
- return null_frame_id;
+ if (!frame_chain_valid (base, next_frame))
+ return;
}
- if (id.base == 0)
- return null_frame_id;
+ if (base == 0)
+ return;
/* FIXME: cagney/2002-06-08: This should probably return the frame's
function and not the PC (a.k.a. resume address). */
- id.pc = frame_pc_unwind (next_frame);
- return id;
+ pc = frame_pc_unwind (next_frame);
+ id->pc = pc;
+ id->base = base;
}
/* Function: get_saved_register
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.60
diff -u -r1.60 frame.h
--- frame.h 14 Jan 2003 00:07:42 -0000 1.60
+++ frame.h 16 Jan 2003 16:03:02 -0000
@@ -335,8 +335,9 @@
/* Same as for registers above, but return the ID of the frame that
called this one. */
-typedef struct frame_id (frame_id_unwind_ftype) (struct frame_info *frame,
- void **unwind_cache);
+typedef void (frame_id_unwind_ftype) (struct frame_info *frame,
+ void **unwind_cache,
+ struct frame_id *id);
/* Describe the saved registers of a frame. */