Module: wine
Branch: master
Commit: d49fe171f77a0ff5501efc653d602380d82592a4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d49fe171f77a0ff5501efc653…
Author: Eric Pouech <eric.pouech(a)orange.fr>
Date: Tue Mar 30 21:37:22 2010 +0200
winedbg: Allow backtraces to properly return address outside functions.
---
programs/winedbg/stack.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index 4b2286c..7ba2773 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -83,6 +83,15 @@ static BOOL stack_get_frame(int nf, IMAGEHLP_STACK_FRAME* ihsf)
{
memset(ihsf, 0, sizeof(*ihsf));
ihsf->InstructionOffset = dbg_curr_thread->frames[nf].linear_pc;
+ /* if we're not the first frame, InstructionOffset is the return address
+ * after the call instruction (at least on most processors I know of).
+ * However, there are cases where this address is outside of the current function.
+ * This happens when the called function is marked <NO RETURN>, in which
+ * case the compiler can omit the epilog (gcc 4 does it)
+ * Therefore, we decrement InstructionOffset in order to ensure that
+ * the considered address is really inside the current function.
+ */
+ if (nf) ihsf->InstructionOffset--;
ihsf->FrameOffset = dbg_curr_thread->frames[nf].linear_frame;
ihsf->StackOffset = dbg_curr_thread->frames[nf].linear_stack;
return TRUE;