Generate a more complete context in debug_minidump.

This commit is contained in:
/dev/urandom 2016-08-27 21:18:51 +02:00
parent fddfc56ae1
commit d3d8884f93
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -193,19 +193,34 @@ namespace Components
Command::Execute(command, false); Command::Execute(command, false);
}); });
#pragma warning(push)
#pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
Command::Add("debug_minidump", [](Command::Params) Command::Add("debug_minidump", [](Command::Params)
{ {
CONTEXT ectx; CONTEXT ectx;
ZeroMemory(&ectx, sizeof(CONTEXT));
ectx.ContextFlags = CONTEXT_CONTROL;
__asm
{
Label:
mov[ectx.Ebp], ebp;
mov[ectx.Esp], esp;
mov eax, [Label];
mov[ectx.Eip], eax;
}
EXCEPTION_RECORD erec; EXCEPTION_RECORD erec;
erec.ExceptionAddress = 0x0; ZeroMemory(&erec, sizeof(EXCEPTION_RECORD));
erec.ExceptionAddress = _ReturnAddress();
erec.ExceptionCode = EXCEPTION_BREAKPOINT; erec.ExceptionCode = EXCEPTION_BREAKPOINT;
EXCEPTION_POINTERS eptr; auto eptr = new EXCEPTION_POINTERS();
eptr.ContextRecord = &ectx; eptr->ContextRecord = &ectx;
eptr.ExceptionRecord = &erec; eptr->ExceptionRecord = &erec;
Exception::ExceptionFilter(&eptr); Exception::ExceptionFilter(eptr);
}); });
#pragma warning(pop)
} }
} }