问题
I am implementing logging of error message (It includes information of exception backtrace). I asked similar question how to do this at Reliable way to print exception backtrace in catch handler?. I decided to check out callstacks at x86
and x64
platforms. Result of stack comparisons surprised me. Here is my program:
#include <iostream>
#include <Windows.h>
using namespace std;
struct A
{
};
void foo3()
{
throw A();
}
void foo2()
{
foo3();
}
void foo1()
{
foo2();
}
void foo()
{
try
{
foo1();
}
catch(...)
{
cout << "exception rethrowing" << endl;
throw;
}
}
int seh_filter(_EXCEPTION_POINTERS* exception)
{
cout << "SEH FILTER" << endl;
return EXCEPTION_EXECUTE_HANDLER;
}
int main(void)
{
__try
{
foo();
}
__except(seh_filter(GetExceptionInformation()))
{
cout << "SEH catch handler" << endl;
}
return 0;
}
I set breakpoint at seh_filter
to explore backtrace and ran debug builds. Here is images:
It seems like I cannot print full call stack on x64
platform. What's going on? I cannot understand why were callstacks changed so dramatically? I am using msvc2013 on Windows 10.
来源:https://stackoverflow.com/questions/48985041/different-seh-filtering-in-x86-and-x64