# HG changeset patch # User Ao Qi # Date 1291083782 -28800 # Node ID 76218a369227aa4f35e866485184a45060cbbaa2 # Parent 7d01189d02d7ce2978289ffa6a02f4a90eeece8a Disable output in JVM_handle_linux_signal with the product version. diff -r 7d01189d02d7 -r 76218a369227 hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp --- a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp Mon Dec 13 08:40:39 2010 +0800 +++ b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp Tue Nov 30 10:23:02 2010 +0800 @@ -184,6 +184,7 @@ siginfo_t* info, void* ucVoid, int abort_if_unrecognized) { +#ifndef PRODUCT tty->print_cr("signal infomation:\n\ signo = %x, \n\ sicode = %x, \n\ @@ -193,6 +194,7 @@ info->si_code, info->si_errno, info->si_addr); +#endif ucontext_t* uc = (ucontext_t*) ucVoid; @@ -225,11 +227,15 @@ if (os::Linux::signal_handlers_are_installed) { if (t != NULL ){ if(t->is_Java_thread()) { +#ifndef PRODUCT tty->print_cr("this thread is a java thread\n"); +#endif thread = (JavaThread*)t; } else if(t->is_VM_thread()){ +#ifndef PRODUCT tty->print_cr("this thread is a VM thread\n"); +#endif vmthread = (VMThread *)t; } } @@ -240,7 +246,9 @@ address pc = NULL; pc = (address) os::Linux::ucontext_get_pc(uc); +#ifndef PRODUCT tty->print_cr("pc=%x", pc); +#endif //%note os_trap_1 if (info != NULL && uc != NULL && thread != NULL) { pc = (address) os::Linux::ucontext_get_pc(uc); @@ -248,41 +256,57 @@ if (sig == SIGSEGV) { address addr = (address) info->si_addr; // check if fault address is within thread stack +#ifndef PRODUCT printf("handle all stack overflow variations\n"); printf("addr = %x, stack base = %x, stack top = %x\n", addr, thread->stack_base(), thread->stack_base() - thread->stack_size()); +#endif if (addr < thread->stack_base() && addr >= thread->stack_base() - thread->stack_size()) { // stack overflow +#ifndef PRODUCT printf("stack exception check \n"); +#endif if (thread->in_stack_yellow_zone(addr)) { +#ifndef PRODUCT printf("exception addr is in yellow zone\n"); +#endif thread->disable_stack_yellow_zone(); if (thread->thread_state() == _thread_in_Java) { // Throw a stack overflow exception. Guard pages will be reenabled // while unwinding the stack. +#ifndef PRODUCT printf("this thread is in java\n"); +#endif stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); } else { // Thread was in the vm or native code. Return and try to finish. +#ifndef PRODUCT printf("this thread is in vm or native codes and return\n"); +#endif return 1; } } else if (thread->in_stack_red_zone(addr)) { // Fatal red zone violation. Disable the guard pages and fall through // to handle_unexpected_exception way down below. +#ifndef PRODUCT printf("exception addr is in red zone\n"); +#endif thread->disable_stack_red_zone(); +#ifndef PRODUCT tty->print_raw_cr("An irrecoverable stack overflow has occurred."); +#endif } else { // Accessing stack address below sp may cause SEGV if current // thread has MAP_GROWSDOWN stack. This should only happen when // current thread was created by user code with MAP_GROWSDOWN flag // and then attached to VM. See notes in os_linux.cpp. +#ifndef PRODUCT printf("exception addr is neither in yellow zone nor in the red one\n"); +#endif if (thread->osthread()->expanding_stack() == 0) { thread->osthread()->set_expanding_stack(); if (os::Linux::manually_expand_stack(thread, addr)) { @@ -300,8 +324,10 @@ if (thread->thread_state() == _thread_in_Java) { // Java thread running in Java code => find exception handler if any // a fault inside compiled code, the interpreter, or a stub +#ifndef PRODUCT tty->print("java thread running in java code\n"); tty->print_cr("polling address = %x", os::get_polling_page()); +#endif if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { stub = SharedRuntime::get_poll_stub(pc); @@ -311,7 +337,9 @@ // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; +#ifndef PRODUCT printf("cb = %x, nm = %x\n", cb, nm); +#endif if (nm != NULL && nm->has_unsafe_access()) { stub = StubRoutines::handler_for_unsafe_access(); } @@ -339,25 +367,33 @@ else if (sig == SIGSEGV && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { // Determination of interpreter/vtable stub/compiled code null exception +#ifndef PRODUCT printf("continuation for implicit exception\n"); +#endif stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); } } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { +#ifndef PRODUCT tty->print_cr("SIGBUS in vm thread \n"); +#endif stub = StubRoutines::handler_for_unsafe_access(); } // jni_fast_GetField can trap at certain pc's if a GC kicks in // and the heap gets shrunk before the field access. if ((sig == SIGSEGV) || (sig == SIGBUS)) { +#ifndef PRODUCT printf("jni fast get trap\n"); +#endif address addr = JNI_FastGetField::find_slowcase_pc(pc); if (addr != (address)-1) { stub = addr; } +#ifndef PRODUCT tty->print_cr("addr = %d, stub = %d\n", addr, stub); +#endif } // Check to see if we caught the safepoint code in the @@ -367,7 +403,9 @@ if ((sig == SIGSEGV) && os::is_memory_serialize_page(thread, (address) info->si_addr)) { // Block current thread until the memory serialize page permission restored. +#ifndef PRODUCT printf("write protecting the memory serialiazation page\n"); +#endif os::block_on_serialize_page_trap(); return true; } @@ -394,7 +432,9 @@ //(uc->uc_mcontext.cause == 2 || uc->uc_mcontext.cause == 3)) { (uc->uc_mcontext.hi1 == 2 || uc->uc_mcontext.hi1 == 3)) { //aoqi: copy from jdk1.5, dont understand the struct mcontext_t. +#ifndef PRODUCT tty->print_cr("execution protection violation\n"); +#endif int page_size = os::vm_page_size(); address addr = (address) info->si_addr; @@ -462,7 +502,9 @@ } if (stub != NULL) { +#ifndef PRODUCT tty->print_cr("resolved stub=%d\n",stub); +#endif // save all thread context in case we need to restore it if (thread != NULL) thread->set_saved_exception_pc(pc); @@ -472,13 +514,17 @@ // signal-chaining if (os::Linux::chained_handler(sig, info, ucVoid)) { +#ifndef PRODUCT tty->print_cr("signal chaining\n"); +#endif return true; } if (!abort_if_unrecognized) { // caller wants another chance, so give it to him +#ifndef PRODUCT tty->print_cr("abort becauce of unrecognized\n"); +#endif return false; } @@ -491,7 +537,9 @@ sigemptyset(&newset); sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - tty->print_cr("VMError in signal handler\n"); +#ifndef PRODUCT + tty->print_cr("VMError in signal handler\n"); +#endif VMError err(t, sig, pc, info, ucVoid); err.report_and_die();