8185734: [Windows] Structured Exception Catcher missing around gtest execution

Reviewed-by: dholmes, ihse
This commit is contained in:
Thomas Stuefe 2020-12-15 09:02:46 +00:00
parent 3ab1dfeb8f
commit 568dc29b9a
5 changed files with 17 additions and 0 deletions

View File

@ -608,6 +608,7 @@ define SetupRunGtestTestBody
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
-jdk $(JDK_UNDER_TEST) $$($1_GTEST_FILTER) \
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
--gtest_catch_exceptions=0 \
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
$$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \

View File

@ -512,6 +512,7 @@ struct tm* os::gmtime_pd(const time_t* clock, struct tm* res) {
return NULL;
}
JNIEXPORT
LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
// Thread start routine for all newly created threads
@ -2441,6 +2442,7 @@ static inline void report_error(Thread* t, DWORD exception_code,
}
//-----------------------------------------------------------------------------
JNIEXPORT
LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
PEXCEPTION_RECORD exception_record = exceptionInfo->ExceptionRecord;

View File

@ -68,6 +68,7 @@
#define REG_PC Eip
#endif // AMD64
JNIEXPORT
extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
// Install a win32 structured exception handler around thread.

View File

@ -23,11 +23,23 @@
#include "jni.h"
#ifdef _WIN32
#include <windows.h>
#include <excpt.h>
extern LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
#endif
extern "C" {
JNIIMPORT void JNICALL runUnitTests(int argv, char** argc);
}
int main(int argc, char** argv) {
#ifdef _WIN32
__try {
#endif
runUnitTests(argc, argv);
#ifdef _WIN32
} __except(topLevelExceptionFilter(GetExceptionInformation())) {}
#endif
return 0;
}

View File

@ -82,6 +82,7 @@ public class GTestWrapper {
command.add("-jdk");
command.add(Utils.TEST_JDK);
command.add("--gtest_output=xml:" + resultFile);
command.add("--gtest_catch_exceptions=0" + resultFile);
for (String a : args) {
command.add(a);
}