mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8020775: PPC64 (part 12): posix signal printing
Implement methods printing posix signal information and call them in unix os files. Reviewed-by: kvn, dholmes, twisti
This commit is contained in:
parent
1619c53530
commit
a72b868ac2
5 changed files with 555 additions and 177 deletions
|
@ -2231,58 +2231,12 @@ void os::pd_print_cpu_info(outputStream* st) {
|
|||
st->cr();
|
||||
}
|
||||
|
||||
// Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific
|
||||
// but they're the same for all the linux arch that we support
|
||||
// and they're the same for solaris but there's no common place to put this.
|
||||
const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR",
|
||||
"ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG",
|
||||
"ILL_COPROC", "ILL_BADSTK" };
|
||||
|
||||
const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
|
||||
"FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
|
||||
"FPE_FLTINV", "FPE_FLTSUB", "FPE_FLTDEN" };
|
||||
|
||||
const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
|
||||
|
||||
const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" };
|
||||
|
||||
void os::print_siginfo(outputStream* st, void* siginfo) {
|
||||
st->print("siginfo:");
|
||||
const siginfo_t* si = (const siginfo_t*)siginfo;
|
||||
|
||||
const int buflen = 100;
|
||||
char buf[buflen];
|
||||
siginfo_t *si = (siginfo_t*)siginfo;
|
||||
st->print("si_signo=%s: ", os::exception_name(si->si_signo, buf, buflen));
|
||||
if (si->si_errno != 0 && strerror_r(si->si_errno, buf, buflen) == 0) {
|
||||
st->print("si_errno=%s", buf);
|
||||
} else {
|
||||
st->print("si_errno=%d", si->si_errno);
|
||||
}
|
||||
const int c = si->si_code;
|
||||
assert(c > 0, "unexpected si_code");
|
||||
switch (si->si_signo) {
|
||||
case SIGILL:
|
||||
st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]);
|
||||
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
|
||||
break;
|
||||
case SIGFPE:
|
||||
st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]);
|
||||
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
|
||||
break;
|
||||
case SIGSEGV:
|
||||
st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]);
|
||||
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
|
||||
break;
|
||||
case SIGBUS:
|
||||
st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]);
|
||||
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
|
||||
break;
|
||||
default:
|
||||
st->print(", si_code=%d", si->si_code);
|
||||
// no si_addr
|
||||
}
|
||||
os::Posix::print_siginfo_brief(st, si);
|
||||
|
||||
if ((si->si_signo == SIGBUS || si->si_signo == SIGSEGV) &&
|
||||
if (si && (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) &&
|
||||
UseSharedSpaces) {
|
||||
FileMapInfo* mapinfo = FileMapInfo::current_info();
|
||||
if (mapinfo->is_in_shared_space(si->si_addr)) {
|
||||
|
@ -4278,7 +4232,8 @@ static void print_signal_handler(outputStream* st, int sig,
|
|||
st->print("[%s]", get_signal_handler_name(handler, buf, buflen));
|
||||
}
|
||||
|
||||
st->print(", sa_mask[0]=" PTR32_FORMAT, *(uint32_t*)&sa.sa_mask);
|
||||
st->print(", sa_mask[0]=");
|
||||
os::Posix::print_signal_set_short(st, &sa.sa_mask);
|
||||
|
||||
address rh = VMError::get_resetted_sighandler(sig);
|
||||
// May be, handler was resetted by VMError?
|
||||
|
@ -4287,7 +4242,8 @@ static void print_signal_handler(outputStream* st, int sig,
|
|||
sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
|
||||
}
|
||||
|
||||
st->print(", sa_flags=" PTR32_FORMAT, sa.sa_flags);
|
||||
st->print(", sa_flags=");
|
||||
os::Posix::print_sa_flags(st, sa.sa_flags);
|
||||
|
||||
// Check: is it our handler?
|
||||
if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue