Skip to content

Commit b4478fc

Browse files
committed
LIBS: merged msvc fix for backward
see bombela/backward-cpp#336
1 parent 93ece77 commit b4478fc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

contrib/libs/backward/backward.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4342,7 +4342,7 @@ class SignalHandling {
43424342
}
43434343
cv().notify_one();
43444344
}) {
4345-
SetUnhandledExceptionFilter(crash_handler);
4345+
*prev_exception_filter_ptr() = SetUnhandledExceptionFilter(crash_handler);
43464346

43474347
signal(SIGABRT, signal_handler);
43484348
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
@@ -4378,6 +4378,11 @@ class SignalHandling {
43784378
return &data;
43794379
}
43804380

4381+
static LPTOP_LEVEL_EXCEPTION_FILTER *prev_exception_filter_ptr() {
4382+
static LPTOP_LEVEL_EXCEPTION_FILTER prev_exception_filter;
4383+
return &prev_exception_filter;
4384+
}
4385+
43814386
enum class crash_status { running, crashed, normal_exit, ending };
43824387

43834388
static crash_status &crashed() {
@@ -4441,6 +4446,11 @@ class SignalHandling {
44414446
}
44424447

44434448
NOINLINE static LONG WINAPI crash_handler(EXCEPTION_POINTERS *info) {
4449+
// Pass-through MSVC exceptions
4450+
if ((*prev_exception_filter_ptr()) != nullptr &&
4451+
info->ExceptionRecord->ExceptionCode == 0xE06D7363) {
4452+
return (*prev_exception_filter_ptr())(info);
4453+
}
44444454
// The exception info supplies a trace from exactly where the issue was,
44454455
// no need to skip records
44464456
crash_handler(0, info->ContextRecord);

0 commit comments

Comments
 (0)