Path: blob/master/src/hotspot/os/windows/vmError_windows.cpp
40930 views
/*1* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "cds/metaspaceShared.hpp"26#include "runtime/arguments.hpp"27#include "runtime/os.hpp"28#include "runtime/thread.hpp"29#include "utilities/vmError.hpp"3031LONG WINAPI crash_handler(struct _EXCEPTION_POINTERS* exceptionInfo) {32DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;33VMError::report_and_die(NULL, exception_code, NULL, exceptionInfo->ExceptionRecord,34exceptionInfo->ContextRecord);35return EXCEPTION_CONTINUE_SEARCH;36}3738void VMError::install_secondary_signal_handler() {39SetUnhandledExceptionFilter(crash_handler);40}4142// Write a hint to the stream in case siginfo relates to a segv/bus error43// and the offending address points into CDS archive.44void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {45#if INCLUDE_CDS46if (siginfo && UseSharedSpaces) {47const EXCEPTION_RECORD* const er = (const EXCEPTION_RECORD*)siginfo;48if (er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR &&49er->NumberParameters >= 2) {50const void* const fault_addr = (const void*) er->ExceptionInformation[1];51if (fault_addr != NULL) {52if (MetaspaceShared::is_in_shared_metaspace(fault_addr)) {53st->print("Error accessing class data sharing archive. "54"Mapped file inaccessible during execution, possible disk/network problem.");55}56}57}58}59#endif60}6162// Error reporting cancellation: there is no easy way to implement this on Windows, because we do63// not have an easy way to send signals to threads (aka to cause a win32 Exception in another64// thread). We would need something like "RaiseException(HANDLE thread)"...65void VMError::reporting_started() {}66void VMError::interrupt_reporting_thread() {}67686970