< prev index next >

src/share/vm/utilities/debug.cpp

Print this page




 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) {


 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(), 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(), 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(), 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) {


 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();
 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);
< prev index next >