src/hotspot/os/posix/vmError_posix.cpp
author stuefe
Fri, 30 Mar 2018 06:31:16 +0200
changeset 49653 a569cb4425f3
parent 48794 ea0d0781c63c
child 55653 3243c42d737d
permissions -rw-r--r--
8191101: Show register content in hs-err file on assert Reviewed-by: adinn, clanger, simonis
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     1
/*
48794
ea0d0781c63c 8178351: Simplify MetaspaceShared::is_in_shared_space and MetaspaceObj::is_shared
iklam
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     4
 *
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     8
 *
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    13
 * accompanied this code).
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    14
 *
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    18
 *
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    21
 * questions.
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    22
 *
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    23
 */
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    24
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    25
#include "precompiled.hpp"
48794
ea0d0781c63c 8178351: Simplify MetaspaceShared::is_in_shared_space and MetaspaceObj::is_shared
iklam
parents: 47216
diff changeset
    26
#include "memory/metaspaceShared.hpp"
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    27
#include "runtime/arguments.hpp"
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    28
#include "runtime/os.hpp"
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    29
#include "runtime/thread.hpp"
49653
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
    30
#include "utilities/debug.hpp"
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    31
#include "utilities/vmError.hpp"
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    32
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    33
#include <sys/types.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    34
#include <sys/wait.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    35
#include <signal.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    36
40010
e32d5e545789 8161258: Simplify including platform files.
goetz
parents: 35176
diff changeset
    37
#ifdef LINUX
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    38
#include <sys/syscall.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    39
#include <unistd.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    40
#endif
40010
e32d5e545789 8161258: Simplify including platform files.
goetz
parents: 35176
diff changeset
    41
#ifdef SOLARIS
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    42
#include <thread.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    43
#endif
40010
e32d5e545789 8161258: Simplify including platform files.
goetz
parents: 35176
diff changeset
    44
#ifdef AIX
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    45
#include <unistd.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    46
#endif
40010
e32d5e545789 8161258: Simplify including platform files.
goetz
parents: 35176
diff changeset
    47
#ifdef BSD
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    48
#include <sys/syscall.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    49
#include <unistd.h>
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    50
#endif
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    51
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    52
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    53
// handle all synchronous program error signals which may happen during error
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    54
// reporting. They must be unblocked, caught, handled.
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    55
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    56
static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    57
static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    58
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    59
// Space for our "saved" signal flags and handlers
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    60
static int resettedSigflags[NUM_SIGNALS];
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    61
static address resettedSighandler[NUM_SIGNALS];
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    62
46284
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    63
// Needed for cancelable steps.
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    64
static volatile pthread_t reporter_thread_id;
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    65
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    66
void VMError::reporting_started() {
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    67
  // record pthread id of reporter thread.
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    68
  reporter_thread_id = ::pthread_self();
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    69
}
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    70
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    71
void VMError::interrupt_reporting_thread() {
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    72
  // We misuse SIGILL here, but it does not really matter. We need
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    73
  //  a signal which is handled by crash_handler and not likely to
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    74
  //  occurr during error reporting itself.
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    75
  ::pthread_kill(reporter_thread_id, SIGILL);
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    76
}
ad578adff5df 8166944: Hanging Error Reporting steps may lead to torn error logs.
stuefe
parents: 40010
diff changeset
    77
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    78
static void save_signal(int idx, int sig)
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    79
{
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    80
  struct sigaction sa;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    81
  sigaction(sig, NULL, &sa);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    82
  resettedSigflags[idx]   = sa.sa_flags;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    83
  resettedSighandler[idx] = (sa.sa_flags & SA_SIGINFO)
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    84
                              ? CAST_FROM_FN_PTR(address, sa.sa_sigaction)
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    85
                              : CAST_FROM_FN_PTR(address, sa.sa_handler);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    86
}
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    87
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    88
int VMError::get_resetted_sigflags(int sig) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    89
  for (int i = 0; i < NUM_SIGNALS; i++) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    90
    if (SIGNALS[i] == sig) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    91
      return resettedSigflags[i];
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    92
    }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    93
  }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    94
  return -1;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    95
}
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    96
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    97
address VMError::get_resetted_sighandler(int sig) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    98
  for (int i = 0; i < NUM_SIGNALS; i++) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
    99
    if (SIGNALS[i] == sig) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   100
      return resettedSighandler[i];
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   101
    }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   102
  }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   103
  return NULL;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   104
}
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   105
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   106
static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   107
  // unmask current signal
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   108
  sigset_t newset;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   109
  sigemptyset(&newset);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   110
  sigaddset(&newset, sig);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   111
  // also unmask other synchronous signals
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   112
  for (int i = 0; i < NUM_SIGNALS; i++) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   113
    sigaddset(&newset, SIGNALS[i]);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   114
  }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   115
  os::Posix::unblock_thread_signal_mask(&newset);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   116
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   117
  // support safefetch faults in error handling
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   118
  ucontext_t* const uc = (ucontext_t*) ucVoid;
46361
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   119
  address pc = (uc != NULL) ? os::Posix::ucontext_get_pc(uc) : NULL;
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   120
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   121
  // Correct pc for SIGILL, SIGFPE (see JDK-8176872)
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   122
  if (sig == SIGILL || sig == SIGFPE) {
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   123
    pc = (address) info->si_addr;
b4c026dd6128 8176872: [s390] wrong pc shown in error logs
stuefe
parents: 46284
diff changeset
   124
  }
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   125
49653
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   126
  // Needed to make it possible to call SafeFetch.. APIs in error handling.
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   127
  if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   128
    os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   129
    return;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   130
  }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   131
49653
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   132
  // Needed because asserts may happen in error handling too.
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   133
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   134
  if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   135
    handle_assert_poison_fault(ucVoid, info->si_addr);
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   136
    return;
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   137
  }
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   138
#endif // CAN_SHOW_REGISTERS_ON_ASSERT
a569cb4425f3 8191101: Show register content in hs-err file on assert
stuefe
parents: 48794
diff changeset
   139
34305
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   140
  VMError::report_and_die(NULL, sig, pc, info, ucVoid);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   141
}
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   142
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   143
void VMError::reset_signal_handlers() {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   144
  // install signal handlers for all synchronous program error signals
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   145
  sigset_t newset;
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   146
  sigemptyset(&newset);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   147
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   148
  for (int i = 0; i < NUM_SIGNALS; i++) {
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   149
    save_signal(i, SIGNALS[i]);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   150
    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   151
    sigaddset(&newset, SIGNALS[i]);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   152
  }
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   153
  os::Posix::unblock_thread_signal_mask(&newset);
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   154
e399e6b44631 8136978: Much nearly duplicated code for vmError support
sebastian
parents:
diff changeset
   155
}
35176
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   156
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   157
// Write a hint to the stream in case siginfo relates to a segv/bus error
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   158
// and the offending address points into CDS archive.
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   159
void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
46689
59f0972cf342 8184323: compile-time guard some UseSharedSpaces-only coding with the INCLUDE_CDS macro
mbaesken
parents: 46361
diff changeset
   160
#if INCLUDE_CDS
35176
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   161
  if (siginfo && UseSharedSpaces) {
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   162
    const siginfo_t* const si = (siginfo_t*)siginfo;
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   163
    if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   164
      const void* const fault_addr = si->si_addr;
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   165
      if (fault_addr != NULL) {
48794
ea0d0781c63c 8178351: Simplify MetaspaceShared::is_in_shared_space and MetaspaceObj::is_shared
iklam
parents: 47216
diff changeset
   166
        if (MetaspaceShared::is_in_shared_metaspace(fault_addr)) {
35176
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   167
          st->print("Error accessing class data sharing archive. "
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   168
            "Mapped file inaccessible during execution, possible disk/network problem.");
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   169
        }
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   170
      }
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   171
    }
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   172
  }
46689
59f0972cf342 8184323: compile-time guard some UseSharedSpaces-only coding with the INCLUDE_CDS macro
mbaesken
parents: 46361
diff changeset
   173
#endif
35176
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   174
}
11a9d4022d9e 8144219: [posix] Remove redundant code around os::print_siginfo()
stuefe
parents: 34305
diff changeset
   175