Loading... (original) (raw)

We don't print whole stack if native frames intermix with compiled java frames in Java thread (on x86 fp is used by compiled code).

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1e28428] void VMError::report(outputStream*)+0x1478
V [libjvm.so+0x1e29dd4] void VMError::report_and_die()+0x6b4
V [libjvm.so+0x14ad9ba] void report_vm_error(const char*,int,const char*,const char*)+0x9a
V [libjvm.so+0x1b6ccf5] void ObjectMonitor::exit(bool,Thread*)+0x125
V [libjvm.so+0x1d41cda] void ObjectSynchronizer::fast_exit(oopDesc*,BasicLock*,Thread*)+0x38a
V [libjvm.so+0x1d41fba] void ObjectSynchronizer::slow_exit(oopDesc*,BasicLock*,Thread*)+0x2a
V [libjvm.so+0x1caa13f] void SharedRuntime::complete_monitor_unlocking_C(oopDesc*,BasicLock*)+0x27f

The next changes seem fixed the problem:

src/share/vm/utilities/vmError.cpp
@@ -590,15 +590,17 @@
while (count++ < StackPrintLimit) {
fr.print_on_error(st, buf, sizeof(buf));
st->cr();
+ // Catch very first native frame by using stack address.
+ if ((address)(fr.sp() + 4) >= _thread->stack_base()) break;

if (count > StackPrintLimit) {

Instead of using os::is_first_C_frame() which produces incorrect result for compiled java frames I am suggesting to look on frame's stack pointer relative to stack's base.