Module: wine Branch: stable Commit: b48a1f9511717e656694fdff4b6373c517e8f2e2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b48a1f9511717e656694fdff4b...
Author: Eric Pouech eric.pouech@orange.fr Date: Sat Sep 11 12:14:59 2010 +0200
dbghelp: Fix regression with prevented StackWalk on i386 CPU to be called with a NULL context. (cherry picked from commit 1e12e90cc9ff62a3fd4a6180326454fbedffa8e5)
---
dlls/dbghelp/cpu_i386.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/dlls/dbghelp/cpu_i386.c b/dlls/dbghelp/cpu_i386.c index a88b00f..7739d13 100644 --- a/dlls/dbghelp/cpu_i386.c +++ b/dlls/dbghelp/cpu_i386.c @@ -108,6 +108,9 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO WORD val; BOOL do_switch; unsigned deltapc = 1; +#ifdef __i386__ + CONTEXT _context; +#endif
/* sanity check */ if (curr_mode >= stm_done) return FALSE; @@ -120,6 +123,21 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO curr_mode == stm_start ? "start" : (curr_mode == stm_16bit ? "16bit" : "32bit"), (void*)(DWORD_PTR)curr_switch, (void*)(DWORD_PTR)next_switch);
+#ifdef __i386__ + if (!context) + { + /* setup a pseudo context for the rest of the code (esp. unwinding) */ + context = &_context; + memset(context, 0, sizeof(*context)); + context->ContextFlags = CONTEXT_CONTROL | CONTEXT_SEGMENTS; + if (frame->AddrPC.Mode != AddrModeFlat) context->SegCs = frame->AddrPC.Segment; + context->Eip = frame->AddrPC.Offset; + if (frame->AddrFrame.Mode != AddrModeFlat) context->SegSs = frame->AddrFrame.Segment; + context->Ebp = frame->AddrFrame.Offset; + if (frame->AddrStack.Mode != AddrModeFlat) context->SegSs = frame->AddrStack.Segment; + context->Esp = frame->AddrStack.Offset; + } +#endif if (curr_mode == stm_start) { THREAD_BASIC_INFORMATION info;