Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/debug.cpp @ 10408:836a62f43af9
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 19 Jun 2013 10:45:56 +0200 |
parents | 89e4d67fdd2a 6ce351ac7339 |
children | 6b0fd0964b87 |
comparison
equal
deleted
inserted
replaced
10086:e0fb8a213650 | 10408:836a62f43af9 |
---|---|
227 { | 227 { |
228 report_vm_error(file, line, "fatal error", message); | 228 report_vm_error(file, line, "fatal error", message); |
229 } | 229 } |
230 | 230 |
231 void report_vm_out_of_memory(const char* file, int line, size_t size, | 231 void report_vm_out_of_memory(const char* file, int line, size_t size, |
232 const char* message) { | 232 VMErrorType vm_err_type, const char* message) { |
233 if (Debugging) return; | 233 if (Debugging) return; |
234 | 234 |
235 Thread* thread = ThreadLocalStorage::get_thread_slow(); | 235 Thread* thread = ThreadLocalStorage::get_thread_slow(); |
236 VMError(thread, file, line, size, message).report_and_die(); | 236 VMError(thread, file, line, size, vm_err_type, message).report_and_die(); |
237 | 237 |
238 // The UseOSErrorReporting option in report_and_die() may allow a return | 238 // The UseOSErrorReporting option in report_and_die() may allow a return |
239 // to here. If so then we'll have to figure out how to handle it. | 239 // to here. If so then we'll have to figure out how to handle it. |
240 guarantee(false, "report_and_die() should not return here"); | 240 guarantee(false, "report_and_die() should not return here"); |
241 } | 241 } |
342 "%s%s# %s%s# %s%s# %s%s# %s%s# " | 342 "%s%s# %s%s# %s%s# %s%s# %s%s# " |
343 "%s%s# %s%s# %s%s# %s%s# %s", | 343 "%s%s# %s%s# %s%s# %s%s# %s", |
344 msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, | 344 msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, |
345 msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, | 345 msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, |
346 msg, eol, msg, eol, msg, eol, msg, eol, msg)); | 346 msg, eol, msg, eol, msg, eol, msg, eol, msg)); |
347 case 8: vm_exit_out_of_memory(num, "ChunkPool::allocate"); | 347 case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); |
348 case 9: ShouldNotCallThis(); | 348 case 9: ShouldNotCallThis(); |
349 case 10: ShouldNotReachHere(); | 349 case 10: ShouldNotReachHere(); |
350 case 11: Unimplemented(); | 350 case 11: Unimplemented(); |
351 // This is last because it does not generate an hs_err* file on Windows. | 351 // This is last because it does not generate an hs_err* file on Windows. |
352 case 12: os::signal_raise(SIGSEGV); | 352 case 12: os::signal_raise(SIGSEGV); |
663 tty->print_cr("compiler debugging"); | 663 tty->print_cr("compiler debugging"); |
664 tty->print_cr(" debug() - to set things up for compiler debugging"); | 664 tty->print_cr(" debug() - to set things up for compiler debugging"); |
665 tty->print_cr(" ndebug() - undo debug"); | 665 tty->print_cr(" ndebug() - undo debug"); |
666 } | 666 } |
667 | 667 |
668 #if 0 | |
669 | |
670 // BobV's command parser for debugging on windows when nothing else works. | |
671 | |
672 enum CommandID { | |
673 CMDID_HELP, | |
674 CMDID_QUIT, | |
675 CMDID_HSFIND, | |
676 CMDID_PSS, | |
677 CMDID_PS, | |
678 CMDID_PSF, | |
679 CMDID_FINDM, | |
680 CMDID_FINDNM, | |
681 CMDID_PP, | |
682 CMDID_BPT, | |
683 CMDID_EXIT, | |
684 CMDID_VERIFY, | |
685 CMDID_THREADS, | |
686 CMDID_ILLEGAL = 99 | |
687 }; | |
688 | |
689 struct CommandParser { | |
690 char *name; | |
691 CommandID code; | |
692 char *description; | |
693 }; | |
694 | |
695 struct CommandParser CommandList[] = { | |
696 (char *)"help", CMDID_HELP, " Dump this list", | |
697 (char *)"quit", CMDID_QUIT, " Return from this routine", | |
698 (char *)"hsfind", CMDID_HSFIND, "Perform an hsfind on an address", | |
699 (char *)"ps", CMDID_PS, " Print Current Thread Stack Trace", | |
700 (char *)"pss", CMDID_PSS, " Print All Thread Stack Trace", | |
701 (char *)"psf", CMDID_PSF, " Print All Stack Frames", | |
702 (char *)"findm", CMDID_FINDM, " Find a Method* from a PC", | |
703 (char *)"findnm", CMDID_FINDNM, "Find an nmethod from a PC", | |
704 (char *)"pp", CMDID_PP, " Find out something about a pointer", | |
705 (char *)"break", CMDID_BPT, " Execute a breakpoint", | |
706 (char *)"exitvm", CMDID_EXIT, "Exit the VM", | |
707 (char *)"verify", CMDID_VERIFY, "Perform a Heap Verify", | |
708 (char *)"thread", CMDID_THREADS, "Dump Info on all Threads", | |
709 (char *)0, CMDID_ILLEGAL | |
710 }; | |
711 | |
712 | |
713 // get_debug_command() | |
714 // | |
715 // Read a command from standard input. | |
716 // This is useful when you have a debugger | |
717 // which doesn't support calling into functions. | |
718 // | |
719 void get_debug_command() | |
720 { | |
721 ssize_t count; | |
722 int i,j; | |
723 bool gotcommand; | |
724 intptr_t addr; | |
725 char buffer[256]; | |
726 nmethod *nm; | |
727 Method* m; | |
728 | |
729 tty->print_cr("You have entered the diagnostic command interpreter"); | |
730 tty->print("The supported commands are:\n"); | |
731 for ( i=0; ; i++ ) { | |
732 if ( CommandList[i].code == CMDID_ILLEGAL ) | |
733 break; | |
734 tty->print_cr(" %s \n", CommandList[i].name ); | |
735 } | |
736 | |
737 while ( 1 ) { | |
738 gotcommand = false; | |
739 tty->print("Please enter a command: "); | |
740 count = scanf("%s", buffer) ; | |
741 if ( count >=0 ) { | |
742 for ( i=0; ; i++ ) { | |
743 if ( CommandList[i].code == CMDID_ILLEGAL ) { | |
744 if (!gotcommand) tty->print("Invalid command, please try again\n"); | |
745 break; | |
746 } | |
747 if ( strcmp(buffer, CommandList[i].name) == 0 ) { | |
748 gotcommand = true; | |
749 switch ( CommandList[i].code ) { | |
750 case CMDID_PS: | |
751 ps(); | |
752 break; | |
753 case CMDID_PSS: | |
754 pss(); | |
755 break; | |
756 case CMDID_PSF: | |
757 psf(); | |
758 break; | |
759 case CMDID_FINDM: | |
760 tty->print("Please enter the hex addr to pass to findm: "); | |
761 scanf("%I64X", &addr); | |
762 m = (Method*)findm(addr); | |
763 tty->print("findm(0x%I64X) returned 0x%I64X\n", addr, m); | |
764 break; | |
765 case CMDID_FINDNM: | |
766 tty->print("Please enter the hex addr to pass to findnm: "); | |
767 scanf("%I64X", &addr); | |
768 nm = (nmethod*)findnm(addr); | |
769 tty->print("findnm(0x%I64X) returned 0x%I64X\n", addr, nm); | |
770 break; | |
771 case CMDID_PP: | |
772 tty->print("Please enter the hex addr to pass to pp: "); | |
773 scanf("%I64X", &addr); | |
774 pp((void*)addr); | |
775 break; | |
776 case CMDID_EXIT: | |
777 exit(0); | |
778 case CMDID_HELP: | |
779 tty->print("Here are the supported commands: "); | |
780 for ( j=0; ; j++ ) { | |
781 if ( CommandList[j].code == CMDID_ILLEGAL ) | |
782 break; | |
783 tty->print_cr(" %s -- %s\n", CommandList[j].name, | |
784 CommandList[j].description ); | |
785 } | |
786 break; | |
787 case CMDID_QUIT: | |
788 return; | |
789 break; | |
790 case CMDID_BPT: | |
791 BREAKPOINT; | |
792 break; | |
793 case CMDID_VERIFY: | |
794 verify();; | |
795 break; | |
796 case CMDID_THREADS: | |
797 threads();; | |
798 break; | |
799 case CMDID_HSFIND: | |
800 tty->print("Please enter the hex addr to pass to hsfind: "); | |
801 scanf("%I64X", &addr); | |
802 tty->print("Calling hsfind(0x%I64X)\n", addr); | |
803 hsfind(addr); | |
804 break; | |
805 default: | |
806 case CMDID_ILLEGAL: | |
807 break; | |
808 } | |
809 } | |
810 } | |
811 } | |
812 } | |
813 } | |
814 #endif | |
815 | |
816 #endif // !PRODUCT | 668 #endif // !PRODUCT |