651 tty->print_cr(" ps() - print current thread stack"); |
651 tty->print_cr(" ps() - print current thread stack"); |
652 tty->print_cr(" pss() - print all thread stacks"); |
652 tty->print_cr(" pss() - print all thread stacks"); |
653 tty->print_cr(" pm(int pc) - print Method* given compiled PC"); |
653 tty->print_cr(" pm(int pc) - print Method* given compiled PC"); |
654 tty->print_cr(" findm(intptr_t pc) - finds Method*"); |
654 tty->print_cr(" findm(intptr_t pc) - finds Method*"); |
655 tty->print_cr(" find(intptr_t x) - finds & prints nmethod/stub/bytecode/oop based on pointer into it"); |
655 tty->print_cr(" find(intptr_t x) - finds & prints nmethod/stub/bytecode/oop based on pointer into it"); |
|
656 tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g."); |
|
657 tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or"); |
|
658 tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or"); |
|
659 tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or"); |
|
660 tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC"); |
|
661 tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()"); |
|
662 tty->print_cr(" - in dbx do 'frame 1' before calling pns()"); |
656 |
663 |
657 tty->print_cr("misc."); |
664 tty->print_cr("misc."); |
658 tty->print_cr(" flush() - flushes the log file"); |
665 tty->print_cr(" flush() - flushes the log file"); |
659 tty->print_cr(" events() - dump events from ring buffers"); |
666 tty->print_cr(" events() - dump events from ring buffers"); |
660 |
667 |
663 tty->print_cr(" debug() - to set things up for compiler debugging"); |
670 tty->print_cr(" debug() - to set things up for compiler debugging"); |
664 tty->print_cr(" ndebug() - undo debug"); |
671 tty->print_cr(" ndebug() - undo debug"); |
665 } |
672 } |
666 |
673 |
667 #endif // !PRODUCT |
674 #endif // !PRODUCT |
|
675 |
|
676 void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) { |
|
677 |
|
678 // see if it's a valid frame |
|
679 if (fr.pc()) { |
|
680 st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)"); |
|
681 |
|
682 int count = 0; |
|
683 while (count++ < StackPrintLimit) { |
|
684 fr.print_on_error(st, buf, buf_size); |
|
685 st->cr(); |
|
686 // Compiled code may use EBP register on x86 so it looks like |
|
687 // non-walkable C frame. Use frame.sender() for java frames. |
|
688 if (t && t->is_Java_thread()) { |
|
689 // Catch very first native frame by using stack address. |
|
690 // For JavaThread stack_base and stack_size should be set. |
|
691 if (!t->on_local_stack((address)(fr.real_fp() + 1))) { |
|
692 break; |
|
693 } |
|
694 if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) { |
|
695 RegisterMap map((JavaThread*)t, false); // No update |
|
696 fr = fr.sender(&map); |
|
697 } else { |
|
698 fr = os::get_sender_for_C_frame(&fr); |
|
699 } |
|
700 } else { |
|
701 // is_first_C_frame() does only simple checks for frame pointer, |
|
702 // it will pass if java compiled code has a pointer in EBP. |
|
703 if (os::is_first_C_frame(&fr)) break; |
|
704 fr = os::get_sender_for_C_frame(&fr); |
|
705 } |
|
706 } |
|
707 |
|
708 if (count > StackPrintLimit) { |
|
709 st->print_cr("...<more frames>..."); |
|
710 } |
|
711 |
|
712 st->cr(); |
|
713 } |
|
714 } |
|
715 |
|
716 #ifndef PRODUCT |
|
717 |
|
718 extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack |
|
719 Command c("pns"); |
|
720 static char buf[O_BUFLEN]; |
|
721 Thread* t = ThreadLocalStorage::get_thread_slow(); |
|
722 // Call generic frame constructor (certain arguments may be ignored) |
|
723 frame fr(sp, fp, pc); |
|
724 print_native_stack(tty, fr, t, buf, sizeof(buf)); |
|
725 } |
|
726 |
|
727 #endif // !PRODUCT |