comparison src/share/vm/utilities/vmError.cpp @ 22803:f43fad8786fc

8058345: Refactor native stack printing from vmError.cpp to debug.cpp to make it available in gdb as well Summary: Also fix stack trace on x86 to enable walking of runtime stubs and native wrappers Reviewed-by: kvn
author simonis
date Wed, 24 Sep 2014 12:19:07 -0700
parents 417e3b8d04c5
children 9989538b7507
comparison
equal deleted inserted replaced
22802:0ef505d06e12 22803:f43fad8786fc
573 st->cr(); 573 st->cr();
574 } 574 }
575 575
576 STEP(120, "(printing native stack)" ) 576 STEP(120, "(printing native stack)" )
577 577
578 if (_verbose) { 578 if (_verbose) {
579 if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { 579 if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) {
580 // We have printed the native stack in platform-specific code 580 // We have printed the native stack in platform-specific code
581 // Windows/x64 needs special handling. 581 // Windows/x64 needs special handling.
582 } else { 582 } else {
583 frame fr = _context ? os::fetch_frame_from_context(_context) 583 frame fr = _context ? os::fetch_frame_from_context(_context)
584 : os::current_frame(); 584 : os::current_frame();
585 585
586 // see if it's a valid frame 586 print_native_stack(st, fr, _thread, buf, sizeof(buf));
587 if (fr.pc()) {
588 st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)");
589
590
591 int count = 0;
592 while (count++ < StackPrintLimit) {
593 fr.print_on_error(st, buf, sizeof(buf));
594 st->cr();
595 // Compiled code may use EBP register on x86 so it looks like
596 // non-walkable C frame. Use frame.sender() for java frames.
597 if (_thread && _thread->is_Java_thread()) {
598 // Catch very first native frame by using stack address.
599 // For JavaThread stack_base and stack_size should be set.
600 if (!_thread->on_local_stack((address)(fr.sender_sp() + 1))) {
601 break;
602 }
603 if (fr.is_java_frame()) {
604 RegisterMap map((JavaThread*)_thread, false); // No update
605 fr = fr.sender(&map);
606 } else {
607 fr = os::get_sender_for_C_frame(&fr);
608 }
609 } else {
610 // is_first_C_frame() does only simple checks for frame pointer,
611 // it will pass if java compiled code has a pointer in EBP.
612 if (os::is_first_C_frame(&fr)) break;
613 fr = os::get_sender_for_C_frame(&fr);
614 }
615 }
616
617 if (count > StackPrintLimit) {
618 st->print_cr("...<more frames>...");
619 }
620
621 st->cr();
622 }
623 } 587 }
624 } 588 }
625 589
626 STEP(130, "(printing Java stack)" ) 590 STEP(130, "(printing Java stack)" )
627 591