Mark Kettenis wrote: >> Date: Fri, 03 Jul 2009 17:34:59 -0700 >> From: Michael Snyder >> >> Michael Snyder wrote: >>> This comes out of a discussion with Daniel, about how gcc >>> does not generate the right dwarf info to allow correct >>> frame unwinding in function epilogues, causing frame_unwind >>> to return bad results. >>> >>> It's necessary for reverse-step, which will frequently step >>> backward to the return instruction of a function. But it also >>> provides an improvement for forward debugging, in that now, >>> without this change, if you STEPI until you are at the return >>> instruction, you will get a bad backtrace. >>> >>> The infrun changes that take advantage of this patch will follow >>> separately. >>> >>> Michael >> Oops, the patch wasn't meant to have that "#if 0" in it... >> corrected patch below. > > Still has the #if 0 in there. Sorry. ;-( > > I also think you should add a comment about the specific ordering of > this unwinder. It has to come before the dwarf2 unwinder because GCC > doesn't provide proper CFI for the epilogue, right? Right. Since the others are similarly order-dependent, I will expand on their comments as well. >> + if (target_read_memory (pc, &insn, 1) != 0) >> + return 0; /* Can't read memory at pc. */ > > For consistency's sake, can you drop the != 0 here? OK. >> + if (insn != 0xc3) /* RET */ >> + return 0; > > Please use lowercase for instruction mnemonics. OK. Revised patch attached.