comparison src/os/bsd/vm/os_bsd.cpp @ 14460:8a9bb7821e28

Merge
author kvn
date Wed, 19 Feb 2014 12:08:49 -0800
parents b59507f713e0 2b8e28fdf503
children 28f281e8de1d
comparison
equal deleted inserted replaced
14360:e8ef156f0bc9 14460:8a9bb7821e28
217 static char cpu_arch[] = "i386"; 217 static char cpu_arch[] = "i386";
218 #elif defined(AMD64) 218 #elif defined(AMD64)
219 static char cpu_arch[] = "amd64"; 219 static char cpu_arch[] = "amd64";
220 #elif defined(ARM) 220 #elif defined(ARM)
221 static char cpu_arch[] = "arm"; 221 static char cpu_arch[] = "arm";
222 #elif defined(PPC) 222 #elif defined(PPC32)
223 static char cpu_arch[] = "ppc"; 223 static char cpu_arch[] = "ppc";
224 #elif defined(SPARC) 224 #elif defined(SPARC)
225 # ifdef _LP64 225 # ifdef _LP64
226 static char cpu_arch[] = "sparcv9"; 226 static char cpu_arch[] = "sparcv9";
227 # else 227 # else
1675 st->print("\n/proc/meminfo:\n"); 1675 st->print("\n/proc/meminfo:\n");
1676 _print_ascii_file("/proc/meminfo", st); 1676 _print_ascii_file("/proc/meminfo", st);
1677 st->cr(); 1677 st->cr();
1678 } 1678 }
1679 1679
1680 // Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific
1681 // but they're the same for all the bsd arch that we support
1682 // and they're the same for solaris but there's no common place to put this.
1683 const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR",
1684 "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG",
1685 "ILL_COPROC", "ILL_BADSTK" };
1686
1687 const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
1688 "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
1689 "FPE_FLTINV", "FPE_FLTSUB", "FPE_FLTDEN" };
1690
1691 const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
1692
1693 const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" };
1694
1695 void os::print_siginfo(outputStream* st, void* siginfo) { 1680 void os::print_siginfo(outputStream* st, void* siginfo) {
1696 st->print("siginfo:"); 1681 const siginfo_t* si = (const siginfo_t*)siginfo;
1697 1682
1698 const int buflen = 100; 1683 os::Posix::print_siginfo_brief(st, si);
1699 char buf[buflen]; 1684
1700 siginfo_t *si = (siginfo_t*)siginfo; 1685 if (si && (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) &&
1701 st->print("si_signo=%s: ", os::exception_name(si->si_signo, buf, buflen));
1702 if (si->si_errno != 0 && strerror_r(si->si_errno, buf, buflen) == 0) {
1703 st->print("si_errno=%s", buf);
1704 } else {
1705 st->print("si_errno=%d", si->si_errno);
1706 }
1707 const int c = si->si_code;
1708 assert(c > 0, "unexpected si_code");
1709 switch (si->si_signo) {
1710 case SIGILL:
1711 st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]);
1712 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
1713 break;
1714 case SIGFPE:
1715 st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]);
1716 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
1717 break;
1718 case SIGSEGV:
1719 st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]);
1720 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
1721 break;
1722 case SIGBUS:
1723 st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]);
1724 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
1725 break;
1726 default:
1727 st->print(", si_code=%d", si->si_code);
1728 // no si_addr
1729 }
1730
1731 if ((si->si_signo == SIGBUS || si->si_signo == SIGSEGV) &&
1732 UseSharedSpaces) { 1686 UseSharedSpaces) {
1733 FileMapInfo* mapinfo = FileMapInfo::current_info(); 1687 FileMapInfo* mapinfo = FileMapInfo::current_info();
1734 if (mapinfo->is_in_shared_space(si->si_addr)) { 1688 if (mapinfo->is_in_shared_space(si->si_addr)) {
1735 st->print("\n\nError accessing class data sharing archive." \ 1689 st->print("\n\nError accessing class data sharing archive." \
1736 " Mapped file inaccessible during execution, " \ 1690 " Mapped file inaccessible during execution, " \
3415 st->print("SIG_IGN"); 3369 st->print("SIG_IGN");
3416 } else { 3370 } else {
3417 st->print("[%s]", get_signal_handler_name(handler, buf, buflen)); 3371 st->print("[%s]", get_signal_handler_name(handler, buf, buflen));
3418 } 3372 }
3419 3373
3420 st->print(", sa_mask[0]=" PTR32_FORMAT, *(uint32_t*)&sa.sa_mask); 3374 st->print(", sa_mask[0]=");
3375 os::Posix::print_signal_set_short(st, &sa.sa_mask);
3421 3376
3422 address rh = VMError::get_resetted_sighandler(sig); 3377 address rh = VMError::get_resetted_sighandler(sig);
3423 // May be, handler was resetted by VMError? 3378 // May be, handler was resetted by VMError?
3424 if(rh != NULL) { 3379 if(rh != NULL) {
3425 handler = rh; 3380 handler = rh;
3426 sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK; 3381 sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
3427 } 3382 }
3428 3383
3429 st->print(", sa_flags=" PTR32_FORMAT, sa.sa_flags); 3384 st->print(", sa_flags=");
3385 os::Posix::print_sa_flags(st, sa.sa_flags);
3430 3386
3431 // Check: is it our handler? 3387 // Check: is it our handler?
3432 if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) || 3388 if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
3433 handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) { 3389 handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
3434 // It is our signal handler 3390 // It is our signal handler