extern "C" void ps() { // print stack if (Thread::current() == NULL) return; Command c("ps"); // Prints the stack of the current Java thread JavaThread* p = JavaThread::active(); tty->print(" for thread: "); p->print(); tty->cr(); if (p->has_last_Java_frame()) { // If the last_Java_fp is set we are in C land and // can call the standard stack_trace function. #ifdef PRODUCT p->print_stack(); } else { tty->print_cr("Cannot find the last Java frame, printing stack disabled."); #else // !PRODUCT p->trace_stack(); } else {
extern "C" void ps() { // print stack Command c("ps"); // Prints the stack of the current Java thread JavaThread* p = JavaThread::active(); tty->print(" for thread: "); p->print(); tty->cr(); if (p->has_last_Java_frame()) { // If the last_Java_fp is set we are in C land and // can call the standard stack_trace function. p->trace_stack(); } else { frame f = os::current_frame(); RegisterMap reg_map(p); f = f.sender(®_map); tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id()); p->trace_stack_from(vframe::new_vframe(&f, ®_map, p)); pd_ps(f); } }