< prev index next >

src/hotspot/share/utilities/vmError.cpp

Print this page




 382 // thread can report error, so large buffers are statically allocated in data
 383 // segment.
 384 
 385 int          VMError::_current_step;
 386 const char*  VMError::_current_step_info;
 387 
 388 volatile jlong VMError::_reporting_start_time = -1;
 389 volatile bool VMError::_reporting_did_timeout = false;
 390 volatile jlong VMError::_step_start_time = -1;
 391 volatile bool VMError::_step_did_timeout = false;
 392 
 393 // Helper, return current timestamp for timeout handling.
 394 jlong VMError::get_current_timestamp() {
 395   return os::javaTimeNanos();
 396 }
 397 // Factor to translate the timestamp to seconds.
 398 #define TIMESTAMP_TO_SECONDS_FACTOR (1000 * 1000 * 1000)
 399 
 400 void VMError::record_reporting_start_time() {
 401   const jlong now = get_current_timestamp();
 402   Atomic::store(now, &_reporting_start_time);
 403 }
 404 
 405 jlong VMError::get_reporting_start_time() {
 406   return Atomic::load(&_reporting_start_time);
 407 }
 408 
 409 void VMError::record_step_start_time() {
 410   const jlong now = get_current_timestamp();
 411   Atomic::store(now, &_step_start_time);
 412 }
 413 
 414 jlong VMError::get_step_start_time() {
 415   return Atomic::load(&_step_start_time);
 416 }
 417 
 418 void VMError::clear_step_start_time() {
 419   return Atomic::store((jlong)0, &_step_start_time);
 420 }
 421 
 422 void VMError::report(outputStream* st, bool _verbose) {
 423 
 424 # define BEGIN if (_current_step == 0) { _current_step = __LINE__;
 425 # define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; \
 426   record_step_start_time(); _step_did_timeout = false;
 427 # define END clear_step_start_time(); }
 428 
 429   // don't allocate large buffer on stack
 430   static char buf[O_BUFLEN];
 431 
 432   BEGIN
 433 
 434   STEP("printing fatal error message")
 435 
 436     st->print_cr("#");
 437     if (should_report_bug(_id)) {
 438       st->print_cr("# A fatal error has been detected by the Java Runtime Environment:");
 439     } else {


1348   fdStream out(fd_out);
1349   out.set_scratch_buffer(buffer, sizeof(buffer));
1350 
1351   // Depending on the re-entrance depth at this point, fd_log may be -1 or point to an open hs-err file.
1352   fdStream log(fd_log);
1353   log.set_scratch_buffer(buffer, sizeof(buffer));
1354 
1355   // How many errors occurred in error handler when reporting first_error.
1356   static int recursive_error_count;
1357 
1358   // We will first print a brief message to standard out (verbose = false),
1359   // then save detailed information in log file (verbose = true).
1360   static bool out_done = false;         // done printing to standard out
1361   static bool log_done = false;         // done saving error log
1362 
1363   if (SuppressFatalErrorMessage) {
1364       os::abort(CreateCoredumpOnCrash);
1365   }
1366   intptr_t mytid = os::current_thread_id();
1367   if (_first_error_tid == -1 &&
1368       Atomic::cmpxchg(mytid, &_first_error_tid, (intptr_t)-1) == -1) {
1369 
1370     // Initialize time stamps to use the same base.
1371     out.time_stamp().update_to(1);
1372     log.time_stamp().update_to(1);
1373 
1374     _id = id;
1375     _message = message;
1376     _thread = thread;
1377     _pc = pc;
1378     _siginfo = siginfo;
1379     _context = context;
1380     _filename = filename;
1381     _lineno = lineno;
1382     _size = size;
1383     jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args);
1384 
1385     // first time
1386     _error_reported = true;
1387 
1388     reporting_started();




 382 // thread can report error, so large buffers are statically allocated in data
 383 // segment.
 384 
 385 int          VMError::_current_step;
 386 const char*  VMError::_current_step_info;
 387 
 388 volatile jlong VMError::_reporting_start_time = -1;
 389 volatile bool VMError::_reporting_did_timeout = false;
 390 volatile jlong VMError::_step_start_time = -1;
 391 volatile bool VMError::_step_did_timeout = false;
 392 
 393 // Helper, return current timestamp for timeout handling.
 394 jlong VMError::get_current_timestamp() {
 395   return os::javaTimeNanos();
 396 }
 397 // Factor to translate the timestamp to seconds.
 398 #define TIMESTAMP_TO_SECONDS_FACTOR (1000 * 1000 * 1000)
 399 
 400 void VMError::record_reporting_start_time() {
 401   const jlong now = get_current_timestamp();
 402   Atomic::store(&_reporting_start_time, now);
 403 }
 404 
 405 jlong VMError::get_reporting_start_time() {
 406   return Atomic::load(&_reporting_start_time);
 407 }
 408 
 409 void VMError::record_step_start_time() {
 410   const jlong now = get_current_timestamp();
 411   Atomic::store(&_step_start_time, now);
 412 }
 413 
 414 jlong VMError::get_step_start_time() {
 415   return Atomic::load(&_step_start_time);
 416 }
 417 
 418 void VMError::clear_step_start_time() {
 419   return Atomic::store(&_step_start_time, (jlong)0);
 420 }
 421 
 422 void VMError::report(outputStream* st, bool _verbose) {
 423 
 424 # define BEGIN if (_current_step == 0) { _current_step = __LINE__;
 425 # define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; \
 426   record_step_start_time(); _step_did_timeout = false;
 427 # define END clear_step_start_time(); }
 428 
 429   // don't allocate large buffer on stack
 430   static char buf[O_BUFLEN];
 431 
 432   BEGIN
 433 
 434   STEP("printing fatal error message")
 435 
 436     st->print_cr("#");
 437     if (should_report_bug(_id)) {
 438       st->print_cr("# A fatal error has been detected by the Java Runtime Environment:");
 439     } else {


1348   fdStream out(fd_out);
1349   out.set_scratch_buffer(buffer, sizeof(buffer));
1350 
1351   // Depending on the re-entrance depth at this point, fd_log may be -1 or point to an open hs-err file.
1352   fdStream log(fd_log);
1353   log.set_scratch_buffer(buffer, sizeof(buffer));
1354 
1355   // How many errors occurred in error handler when reporting first_error.
1356   static int recursive_error_count;
1357 
1358   // We will first print a brief message to standard out (verbose = false),
1359   // then save detailed information in log file (verbose = true).
1360   static bool out_done = false;         // done printing to standard out
1361   static bool log_done = false;         // done saving error log
1362 
1363   if (SuppressFatalErrorMessage) {
1364       os::abort(CreateCoredumpOnCrash);
1365   }
1366   intptr_t mytid = os::current_thread_id();
1367   if (_first_error_tid == -1 &&
1368       Atomic::cmpxchg(&_first_error_tid, (intptr_t)-1, mytid) == -1) {
1369 
1370     // Initialize time stamps to use the same base.
1371     out.time_stamp().update_to(1);
1372     log.time_stamp().update_to(1);
1373 
1374     _id = id;
1375     _message = message;
1376     _thread = thread;
1377     _pc = pc;
1378     _siginfo = siginfo;
1379     _context = context;
1380     _filename = filename;
1381     _lineno = lineno;
1382     _size = size;
1383     jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args);
1384 
1385     // first time
1386     _error_reported = true;
1387 
1388     reporting_started();


< prev index next >