Support stackwalk64 for 32-bit x86
This commit is contained in:
parent
b80026596f
commit
81b2e46df1
@ -32,9 +32,10 @@ namespace detail {
|
|||||||
// GetThreadContext cannot be used on the current thread.
|
// GetThreadContext cannot be used on the current thread.
|
||||||
// RtlCaptureContext doesn't work on i386
|
// RtlCaptureContext doesn't work on i386
|
||||||
CONTEXT context;
|
CONTEXT context;
|
||||||
#ifdef _M_IX86
|
#if defined(_M_IX86) || defined(__i386__)
|
||||||
ZeroMemory(&context, sizeof(CONTEXT));
|
ZeroMemory(&context, sizeof(CONTEXT));
|
||||||
context.ContextFlags = CONTEXT_CONTROL;
|
context.ContextFlags = CONTEXT_CONTROL;
|
||||||
|
#if IS_MSVC
|
||||||
__asm {
|
__asm {
|
||||||
label:
|
label:
|
||||||
mov [context.Ebp], ebp;
|
mov [context.Ebp], ebp;
|
||||||
@ -43,6 +44,18 @@ namespace detail {
|
|||||||
mov [context.Eip], eax;
|
mov [context.Eip], eax;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
asm(
|
||||||
|
"label:\n\t"
|
||||||
|
"mov{l %%ebp, %[cEbp] | %[cEbp], ebp};\n\t"
|
||||||
|
"mov{l %%esp, %[cEsp] | %[cEsp], esp};\n\t"
|
||||||
|
"mov{l $label, %%eax | eax, label};\n\t"
|
||||||
|
"mov{l %%eax, %[cEip] | %[cEip], eax};\n\t"
|
||||||
|
: [cEbp] "=r" (context.Ebp),
|
||||||
|
[cEsp] "=r" (context.Esp),
|
||||||
|
[cEip] "=r" (context.Eip)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
RtlCaptureContext(&context);
|
RtlCaptureContext(&context);
|
||||||
#endif
|
#endif
|
||||||
// Setup current frame
|
// Setup current frame
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user