Fix debugger for flat PC and non-flat frame.
This commit is contained in:
parent
e85b67bd9e
commit
e4e7186b25
|
@ -113,6 +113,13 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
|
|||
{
|
||||
THREAD_BASIC_INFORMATION info;
|
||||
|
||||
if ((frame->AddrPC.Mode == AddrModeFlat) &&
|
||||
(frame->AddrFrame.Mode != AddrModeFlat))
|
||||
{
|
||||
WARN("Bad AddrPC.Mode / AddrFrame.Mode combination\n");
|
||||
goto done_err;
|
||||
}
|
||||
|
||||
/* Init done */
|
||||
curr_mode = (frame->AddrPC.Mode == AddrModeFlat) ?
|
||||
stm_32bit : stm_16bit;
|
||||
|
|
|
@ -188,6 +188,13 @@ void stack_backtrace(DWORD tid, BOOL noisy)
|
|||
memory_get_current_frame(&sf.AddrFrame);
|
||||
memory_get_current_pc(&sf.AddrPC);
|
||||
|
||||
/* don't confuse StackWalk by passing in inconsistent addresses */
|
||||
if ((sf.AddrPC.Mode == AddrModeFlat) && (sf.AddrFrame.Mode != AddrModeFlat))
|
||||
{
|
||||
sf.AddrFrame.Offset = (DWORD)memory_to_linear_addr(&sf.AddrFrame);
|
||||
sf.AddrFrame.Mode = AddrModeFlat;
|
||||
}
|
||||
|
||||
if (noisy) dbg_printf("Backtrace:\n");
|
||||
while (StackWalk(IMAGE_FILE_MACHINE_I386, dbg_curr_process->handle,
|
||||
thread->handle, &sf, &dbg_context, NULL, SymFunctionTableAccess,
|
||||
|
|
Loading…
Reference in New Issue