[commit] Fix tramp-frame.c crash (Re: graceful unwind termination when we'd need unavailable/uncollect memory or registers to unwind further)

Ulrich Weigand
2011-03-21T17:25:06Z

Pedro Alves wrote:

> (struct frame_unwind) <stop_reason>: New function pointer.

It seems you initialized this field in all statically allocated frame_unwind
structures, but not in those dynamically allocated and returned from the
tramp_frame_prepend_unwinder routine. This causes crashes on all platforms
that use the tramp-frame.c framework ...

Fixed by the following patch.

Tested on powerpc64-linux, committed to mainline.

Bye,
Ulrich

ChangeLog:

* tramp-frame.c (tramp_frame_prepend_unwinder): Set stop_reason
field in returned unwinder.

Index: gdb/tramp-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/tramp-frame.c,v
retrieving revision 1.21
diff -u -p -r1.21 tramp-frame.c
--- gdb/tramp-frame.c 1 Jan 2011 15:33:18 -0000 1.21
+++ gdb/tramp-frame.c 21 Mar 2011 17:14:17 -0000
@@ -163,6 +163,7 @@ tramp_frame_prepend_unwinder (struct gdb
unwinder->type = tramp_frame->frame_type;
unwinder->unwind_data = data;
unwinder->sniffer = tramp_frame_sniffer;
+ unwinder->stop_reason = default_frame_unwind_stop_reason;
unwinder->this_id = tramp_frame_this_id;
unwinder->prev_register = tramp_frame_prev_register;
frame_unwind_prepend_unwinder (gdbarch, unwinder);

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com