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.
|
||||
// RtlCaptureContext doesn't work on i386
|
||||
CONTEXT context;
|
||||
#ifdef _M_IX86
|
||||
#if defined(_M_IX86) || defined(__i386__)
|
||||
ZeroMemory(&context, sizeof(CONTEXT));
|
||||
context.ContextFlags = CONTEXT_CONTROL;
|
||||
#if IS_MSVC
|
||||
__asm {
|
||||
label:
|
||||
mov [context.Ebp], ebp;
|
||||
@ -43,6 +44,18 @@ namespace detail {
|
||||
mov [context.Eip], eax;
|
||||
}
|
||||
#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);
|
||||
#endif
|
||||
// Setup current frame
|
||||
|
||||
Loading…
Reference in New Issue
Block a user