Re: [patch/rfc] Add a sentinel frame

Michal Ludvig
2003-03-05T17:38:16Z

Andrew Cagney wrote:
> Well, to fix this specific bug I think you'd just need to implement:
>
> save_dummy_frame_tos()
> unwind_dummy_id() (see uncommitted patch I posted).
>
> And ensure that the top-of-stack value saved by save_dummy_frame_tos()
> matches the id.base value returned by unwind_dummy_id().

I added this:
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.10
diff -u -p -r1.10 dummy-frame.c
--- dummy-frame.c 19 Jan 2003 17:39:16 -0000 1.10
+++ dummy-frame.c 5 Mar 2003 17:30:56 -0000
@@ -246,6 +246,17 @@ generic_save_dummy_frame_tos (CORE_ADDR
dummy_frame_stack->top = sp;
}

+struct frame_id
+generic_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame)
+{
+ static struct frame_id id;
+
+ id.base = dummy_frame_stack->top;
+ id.pc = frame->pc;
+
+ return id;
+}
+
/* Record the upper/lower bounds on the address of the call dummy. */

void

and registered to the target:
set_gdbarch_save_dummy_frame_tos (gdbarch,generic_save_dummy_frame_tos);
set_gdbarch_unwind_dummy_id (gdbarch, generic_unwind_dummy_id);

I don't know if everything works as it should, but at least simple
(gdb) print func(123)
doesn't segfault and surprisingly even returns a result!

Does the above look correct to you?

Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz