@@ -347,7 +347,7 @@ static frame next_frame(frame fr, Thread* t) {
347347 }
348348}
349349
350- void VMError::print_native_stack (outputStream* st, frame fr, Thread* t, char * buf, int buf_size) {
350+ void VMError::print_native_stack (outputStream* st, frame fr, Thread* t, bool print_source_info, char * buf, int buf_size) {
351351
352352 // see if it's a valid frame
353353 if (fr.pc ()) {
@@ -362,7 +362,8 @@ void VMError::print_native_stack(outputStream* st, frame fr, Thread* t, char* bu
362362 if (count == 1 && _lineno != 0 ) {
363363 // We have source information of the first frame for internal errors. There is no need to parse it from the symbols.
364364 st->print (" (%s:%d)" , get_filename_only (), _lineno);
365- } else if (Decoder::get_source_info (fr.pc (), filename, sizeof (filename), &line_no, count != 1 )) {
365+ } else if (print_source_info &&
366+ Decoder::get_source_info (fr.pc (), filename, sizeof (filename), &line_no, count != 1 )) {
366367 st->print (" (%s:%d)" , filename, line_no);
367368 }
368369 }
@@ -535,6 +536,8 @@ void VMError::report(outputStream* st, bool _verbose) {
535536 // don't allocate large buffer on stack
536537 static char buf[O_BUFLEN];
537538
539+ static bool print_native_stack_succeeded = false ;
540+
538541 BEGIN
539542
540543 STEP (" printing fatal error message" )
@@ -832,7 +835,7 @@ void VMError::report(outputStream* st, bool _verbose) {
832835 st->cr ();
833836 }
834837
835- STEP (" printing native stack" )
838+ STEP (" printing native stack (with source info) " )
836839
837840 if (_verbose) {
838841 if (os::platform_print_native_stack (st, _context, buf, sizeof (buf))) {
@@ -842,9 +845,20 @@ void VMError::report(outputStream* st, bool _verbose) {
842845 frame fr = _context ? os::fetch_frame_from_context (_context)
843846 : os::current_frame ();
844847
845- print_native_stack (st, fr, _thread, buf, sizeof (buf));
848+ print_native_stack (st, fr, _thread, true , buf, sizeof (buf));
846849 _print_native_stack_used = true ;
847850 }
851+ print_native_stack_succeeded = true ;
852+ }
853+
854+ STEP (" retry printing native stack (no source info)" )
855+
856+ if (_verbose && !print_native_stack_succeeded) {
857+ st->cr ();
858+ st->print_cr (" Retrying call stack printing without source information..." );
859+ frame fr = _context ? os::fetch_frame_from_context (_context) : os::current_frame ();
860+ print_native_stack (st, fr, _thread, false , buf, sizeof (buf));
861+ _print_native_stack_used = true ;
848862 }
849863
850864 STEP (" printing Java stack" )
0 commit comments