dbghelp: Fix StackWalk when dwarf or pdb unwinders are called on first frame (CPU i386).

This commit is contained in:
Eric Pouech 2011-03-13 21:30:21 +01:00 committed by Alexandre Julliard
parent c5f329e62c
commit 44eed2465c
1 changed files with 11 additions and 14 deletions

View File

@ -217,26 +217,23 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO
{ {
DWORD_PTR xframe; DWORD_PTR xframe;
struct pdb_cmd_pair cpair[4]; struct pdb_cmd_pair cpair[4];
CONTEXT newctx = *context;
if (dwarf2_virtual_unwind(csw, frame->AddrPC.Offset - deltapc, context, &xframe)) if (dwarf2_virtual_unwind(csw, frame->AddrPC.Offset - deltapc, &newctx, &xframe))
{ {
frame->AddrStack.Mode = frame->AddrFrame.Mode = frame->AddrReturn.Mode = AddrModeFlat; frame->AddrReturn.Mode = AddrModeFlat;
frame->AddrStack.Offset = context->Esp = xframe; frame->AddrReturn.Offset = newctx.Eip;
frame->AddrFrame.Offset = context->Ebp;
frame->AddrReturn.Offset = context->Eip;
goto done_pep; goto done_pep;
} }
cpair[0].name = "$ebp"; cpair[0].pvalue = &context->Ebp; cpair[0].name = "$ebp"; cpair[0].pvalue = &newctx.Ebp;
cpair[1].name = "$esp"; cpair[1].pvalue = &context->Esp; cpair[1].name = "$esp"; cpair[1].pvalue = &newctx.Esp;
cpair[2].name = "$eip"; cpair[2].pvalue = &context->Eip; cpair[2].name = "$eip"; cpair[2].pvalue = &newctx.Eip;
cpair[3].name = NULL; cpair[3].pvalue = NULL; cpair[3].name = NULL; cpair[3].pvalue = NULL;
if (pdb_virtual_unwind(csw, frame->AddrPC.Offset - deltapc, context, cpair)) if (pdb_virtual_unwind(csw, frame->AddrPC.Offset - deltapc, &newctx, cpair))
{ {
frame->AddrStack.Mode = frame->AddrFrame.Mode = frame->AddrReturn.Mode = AddrModeFlat; frame->AddrReturn.Mode = AddrModeFlat;
frame->AddrStack.Offset = context->Esp; frame->AddrReturn.Offset = newctx.Eip;
frame->AddrFrame.Offset = context->Ebp;
frame->AddrReturn.Offset = context->Eip;
goto done_pep; goto done_pep;
} }
} }