198
199 #undef is_token_break
200
201 #else
202
203 // Place-holder for non-existent suppression check:
204 #define error_is_suppressed(file_name, line_no) (false)
205
206 #endif // !PRODUCT
207
208 void report_vm_error(const char* file, int line, const char* error_msg)
209 {
210 report_vm_error(file, line, error_msg, "%s", "");
211 }
212
213 void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...)
214 {
215 if (Debugging || error_is_suppressed(file, line)) return;
216 va_list detail_args;
217 va_start(detail_args, detail_fmt);
218 VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, error_msg, detail_fmt, detail_args);
219 va_end(detail_args);
220 }
221
222 void report_fatal(const char* file, int line, const char* detail_fmt, ...)
223 {
224 if (Debugging || error_is_suppressed(file, line)) return;
225 va_list detail_args;
226 va_start(detail_args, detail_fmt);
227 VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, "fatal error", detail_fmt, detail_args);
228 va_end(detail_args);
229 }
230
231 void report_vm_out_of_memory(const char* file, int line, size_t size,
232 VMErrorType vm_err_type, const char* detail_fmt, ...) {
233 if (Debugging) return;
234 va_list detail_args;
235 va_start(detail_args, detail_fmt);
236 VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, size, vm_err_type, detail_fmt, detail_args);
237 va_end(detail_args);
238
239 // The UseOSErrorReporting option in report_and_die() may allow a return
240 // to here. If so then we'll have to figure out how to handle it.
241 guarantee(false, "report_and_die() should not return here");
242 }
243
244 void report_should_not_call(const char* file, int line) {
245 report_vm_error(file, line, "ShouldNotCall()");
246 }
247
248 void report_should_not_reach_here(const char* file, int line) {
249 report_vm_error(file, line, "ShouldNotReachHere()");
250 }
251
252 void report_unimplemented(const char* file, int line) {
253 report_vm_error(file, line, "Unimplemented()");
254 }
255
256 void report_untested(const char* file, int line, const char* message) {
517 extern "C" void pp(void* p) {
518 Command c("pp");
519 FlagSetting fl(PrintVMMessages, true);
520 FlagSetting f2(DisplayVMOutput, true);
521 if (Universe::heap()->is_in(p)) {
522 oop obj = oop(p);
523 obj->print();
524 } else {
525 tty->print(PTR_FORMAT, p2i(p));
526 }
527 }
528
529
530 // pv: print vm-printable object
531 extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); }
532 extern "C" void findpc(intptr_t x);
533
534 #endif // !PRODUCT
535
536 extern "C" void ps() { // print stack
537 if (Thread::current() == NULL) return;
538 Command c("ps");
539
540
541 // Prints the stack of the current Java thread
542 JavaThread* p = JavaThread::active();
543 tty->print(" for thread: ");
544 p->print();
545 tty->cr();
546
547 if (p->has_last_Java_frame()) {
548 // If the last_Java_fp is set we are in C land and
549 // can call the standard stack_trace function.
550 #ifdef PRODUCT
551 p->print_stack();
552 } else {
553 tty->print_cr("Cannot find the last Java frame, printing stack disabled.");
554 #else // !PRODUCT
555 p->trace_stack();
556 } else {
557 frame f = os::current_frame();
596 extern "C" void threads() {
597 Command c("threads");
598 Threads::print(false, true);
599 }
600
601
602 extern "C" void psd() {
603 Command c("psd");
604 SystemDictionary::print();
605 }
606
607
608 extern "C" void safepoints() {
609 Command c("safepoints");
610 SafepointSynchronize::print_state();
611 }
612
613 #endif // !PRODUCT
614
615 extern "C" void pss() { // print all stacks
616 if (Thread::current() == NULL) return;
617 Command c("pss");
618 Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true));
619 }
620
621 #ifndef PRODUCT
622
623 extern "C" void debug() { // to set things up for compiler debugging
624 Command c("debug");
625 WizardMode = true;
626 PrintVMMessages = PrintCompilation = true;
627 PrintInlining = PrintAssembly = true;
628 tty->flush();
629 }
630
631
632 extern "C" void ndebug() { // undo debug()
633 Command c("ndebug");
634 PrintCompilation = false;
635 PrintInlining = PrintAssembly = false;
636 tty->flush();
753 // is_first_C_frame() does only simple checks for frame pointer,
754 // it will pass if java compiled code has a pointer in EBP.
755 if (os::is_first_C_frame(&fr)) break;
756 fr = os::get_sender_for_C_frame(&fr);
757 }
758 }
759
760 if (count > StackPrintLimit) {
761 st->print_cr("...<more frames>...");
762 }
763
764 st->cr();
765 }
766 }
767
768 #ifndef PRODUCT
769
770 extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack
771 Command c("pns");
772 static char buf[O_BUFLEN];
773 Thread* t = ThreadLocalStorage::get_thread_slow();
774 // Call generic frame constructor (certain arguments may be ignored)
775 frame fr(sp, fp, pc);
776 print_native_stack(tty, fr, t, buf, sizeof(buf));
777 }
778
779 #endif // !PRODUCT
780
781 //////////////////////////////////////////////////////////////////////////////
782 // Test multiple STATIC_ASSERT forms in various scopes.
783
784 #ifndef PRODUCT
785
786 // namespace scope
787 STATIC_ASSERT(true);
788 STATIC_ASSERT(true);
789 STATIC_ASSERT(1 == 1);
790 STATIC_ASSERT(0 == 0);
791
792 void test_multiple_static_assert_forms_in_function_scope() {
793 STATIC_ASSERT(true);
|
198
199 #undef is_token_break
200
201 #else
202
203 // Place-holder for non-existent suppression check:
204 #define error_is_suppressed(file_name, line_no) (false)
205
206 #endif // !PRODUCT
207
208 void report_vm_error(const char* file, int line, const char* error_msg)
209 {
210 report_vm_error(file, line, error_msg, "%s", "");
211 }
212
213 void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...)
214 {
215 if (Debugging || error_is_suppressed(file, line)) return;
216 va_list detail_args;
217 va_start(detail_args, detail_fmt);
218 VMError::report_and_die(Thread::current_or_null(), file, line, error_msg, detail_fmt, detail_args);
219 va_end(detail_args);
220 }
221
222 void report_fatal(const char* file, int line, const char* detail_fmt, ...)
223 {
224 if (Debugging || error_is_suppressed(file, line)) return;
225 va_list detail_args;
226 va_start(detail_args, detail_fmt);
227 VMError::report_and_die(Thread::current_or_null(), file, line, "fatal error", detail_fmt, detail_args);
228 va_end(detail_args);
229 }
230
231 void report_vm_out_of_memory(const char* file, int line, size_t size,
232 VMErrorType vm_err_type, const char* detail_fmt, ...) {
233 if (Debugging) return;
234 va_list detail_args;
235 va_start(detail_args, detail_fmt);
236 VMError::report_and_die(Thread::current_or_null(), file, line, size, vm_err_type, detail_fmt, detail_args);
237 va_end(detail_args);
238
239 // The UseOSErrorReporting option in report_and_die() may allow a return
240 // to here. If so then we'll have to figure out how to handle it.
241 guarantee(false, "report_and_die() should not return here");
242 }
243
244 void report_should_not_call(const char* file, int line) {
245 report_vm_error(file, line, "ShouldNotCall()");
246 }
247
248 void report_should_not_reach_here(const char* file, int line) {
249 report_vm_error(file, line, "ShouldNotReachHere()");
250 }
251
252 void report_unimplemented(const char* file, int line) {
253 report_vm_error(file, line, "Unimplemented()");
254 }
255
256 void report_untested(const char* file, int line, const char* message) {
517 extern "C" void pp(void* p) {
518 Command c("pp");
519 FlagSetting fl(PrintVMMessages, true);
520 FlagSetting f2(DisplayVMOutput, true);
521 if (Universe::heap()->is_in(p)) {
522 oop obj = oop(p);
523 obj->print();
524 } else {
525 tty->print(PTR_FORMAT, p2i(p));
526 }
527 }
528
529
530 // pv: print vm-printable object
531 extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); }
532 extern "C" void findpc(intptr_t x);
533
534 #endif // !PRODUCT
535
536 extern "C" void ps() { // print stack
537 if (Thread::current_or_null() == NULL) return;
538 Command c("ps");
539
540
541 // Prints the stack of the current Java thread
542 JavaThread* p = JavaThread::active();
543 tty->print(" for thread: ");
544 p->print();
545 tty->cr();
546
547 if (p->has_last_Java_frame()) {
548 // If the last_Java_fp is set we are in C land and
549 // can call the standard stack_trace function.
550 #ifdef PRODUCT
551 p->print_stack();
552 } else {
553 tty->print_cr("Cannot find the last Java frame, printing stack disabled.");
554 #else // !PRODUCT
555 p->trace_stack();
556 } else {
557 frame f = os::current_frame();
596 extern "C" void threads() {
597 Command c("threads");
598 Threads::print(false, true);
599 }
600
601
602 extern "C" void psd() {
603 Command c("psd");
604 SystemDictionary::print();
605 }
606
607
608 extern "C" void safepoints() {
609 Command c("safepoints");
610 SafepointSynchronize::print_state();
611 }
612
613 #endif // !PRODUCT
614
615 extern "C" void pss() { // print all stacks
616 if (Thread::current_or_null() == NULL) return;
617 Command c("pss");
618 Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true));
619 }
620
621 #ifndef PRODUCT
622
623 extern "C" void debug() { // to set things up for compiler debugging
624 Command c("debug");
625 WizardMode = true;
626 PrintVMMessages = PrintCompilation = true;
627 PrintInlining = PrintAssembly = true;
628 tty->flush();
629 }
630
631
632 extern "C" void ndebug() { // undo debug()
633 Command c("ndebug");
634 PrintCompilation = false;
635 PrintInlining = PrintAssembly = false;
636 tty->flush();
753 // is_first_C_frame() does only simple checks for frame pointer,
754 // it will pass if java compiled code has a pointer in EBP.
755 if (os::is_first_C_frame(&fr)) break;
756 fr = os::get_sender_for_C_frame(&fr);
757 }
758 }
759
760 if (count > StackPrintLimit) {
761 st->print_cr("...<more frames>...");
762 }
763
764 st->cr();
765 }
766 }
767
768 #ifndef PRODUCT
769
770 extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack
771 Command c("pns");
772 static char buf[O_BUFLEN];
773 Thread* t = Thread::current_or_null();
774 // Call generic frame constructor (certain arguments may be ignored)
775 frame fr(sp, fp, pc);
776 print_native_stack(tty, fr, t, buf, sizeof(buf));
777 }
778
779 #endif // !PRODUCT
780
781 //////////////////////////////////////////////////////////////////////////////
782 // Test multiple STATIC_ASSERT forms in various scopes.
783
784 #ifndef PRODUCT
785
786 // namespace scope
787 STATIC_ASSERT(true);
788 STATIC_ASSERT(true);
789 STATIC_ASSERT(1 == 1);
790 STATIC_ASSERT(0 == 0);
791
792 void test_multiple_static_assert_forms_in_function_scope() {
793 STATIC_ASSERT(true);
|