8353365: TOUCH_ASSERT_POISON clears GetLastError()

Reviewed-by: kbarrett, stuefe, jwaters
This commit is contained in:
David Holmes 2025-04-07 23:36:04 +00:00
parent fd2734e97d
commit 3951a8e019
2 changed files with 12 additions and 0 deletions

View File

@ -2600,6 +2600,7 @@ static inline void report_error(Thread* t, DWORD exception_code,
//-----------------------------------------------------------------------------
JNIEXPORT
LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
PreserveLastError ple;
if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
PEXCEPTION_RECORD exception_record = exceptionInfo->ExceptionRecord;
DWORD exception_code = exception_record->ExceptionCode;

View File

@ -28,6 +28,17 @@
#ifdef ASSERT
#ifdef _WINDOWS
#include <windows.h>
TEST_VM_ASSERT_MSG(vmErrorTest, fatalWithError,
"fatal error: GetLastError should be 6 - actually: 6") {
SetLastError(6);
fatal("GetLastError should be 6 - actually: %lu", GetLastError());
}
#endif // WINDOWS
TEST_VM_ASSERT_MSG(vmErrorTest, resourceMark,
"fatal error: memory leak: allocating without ResourceMark") {