On Wed, 16 Mar 2022 07:48:42 GMT, Yi Yang <yy...@openjdk.org> wrote: >> Yi Yang has refreshed the contents of this pull request, and previous >> commits have been removed. The incremental views will show differences >> compared to the previous content of the PR. The pull request contains one >> new commit since the last revision: >> >> 8283147: Include NonJavaThread stacktrace during thread dump > > Clarification on why there are some one-line frame: > > VMError::print_native_stack output > > "G1 Conc#7" os_prio=0 cpu=2.33ms elapsed=11.39s tid=0x00007f635c004d70 > nid=71098 runnable > Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native > code) > C [libpthread.so.0+0xdb39] do_futex_wait.constprop.1+0x29 > > > pstack outpout > > Thread 40 (Thread 0x7f62b3bf7700 (LWP 71098)): > #0 0x00007f63d32a6b3b in do_futex_wait.constprop () from > /lib64/libpthread.so.0 > #1 0x00007f63d32a6bcf in __new_sem_wait_slow.constprop.0 () from > /lib64/libpthread.so.0 > #2 0x00007f63d32a6c6b in sem_wait@@GLIBC_2.2.5 () from /lib64/libpthread.so.0 > #3 0x00007f63d23f7c32 in PosixSemaphore::wait > (this=this@entry=0x7f63cc077e78) at > /home/qingfeng.yy/jdktip/src/hotspot/os/posix/semaphore_posix.cpp:65 > #4 0x00007f63d265b81b in Semaphore::wait (this=0x7f63cc077e78) at > /home/qingfeng.yy/jdktip/src/hotspot/share/runtime/semaphore.hpp:55 > #5 WorkerTaskDispatcher::worker_run_task (this=0x7f63cc077e68) at > /home/qingfeng.yy/jdktip/src/hotspot/share/gc/shared/workerThread.cpp:60 > #6 WorkerThread::run (this=0x7f635c004d70) at > /home/qingfeng.yy/jdktip/src/hotspot/share/gc/shared/workerThread.cpp:163 > #7 0x00007f63d25aa790 in Thread::call_run (this=this@entry=0x7f635c004d70) > at /home/qingfeng.yy/jdktip/src/hotspot/share/runtime/thread.cpp:357 > #8 0x00007f63d2348a28 in thread_native_entry (thread=0x7f635c004d70) at > /home/qingfeng.yy/jdktip/src/hotspot/os/linux/os_linux.cpp:706 > #9 0x00007f63d32a0ea5 in start_thread () from /lib64/libpthread.so.0 > #10 0x00007f63d2dc58dd in clone () from /lib64/libc.so.6 > > > The top frame is as follows: > > C frame (sp=0x00007f6338ca0d90 unextended sp=0x00007f6338ca0d90, > fp=0x00007f63cc0667c8, real_fp=0x00007f63cc0667c8, pc=0x00007f63d32a6b39 > link=0x0000000900000000) > > do_futex_wait.constprop don't have a valid link/last_frame_pointer, because > libpthread has some novel assembly code: > > > 000000000000db10 <do_futex_wait.constprop.1>: > db10: 55 push %rbp > db11: 48 89 fd mov %rdi,%rbp > db14: 53 push %rbx > db15: 48 83 ec 08 sub $0x8,%rsp > db19: 8b 5f 08 mov 0x8(%rdi),%ebx > db1c: e8 1f 09 00 00 callq e440 > <__pthread_enable_asynccancel> > db21: 45 31 d2 xor %r10d,%r10d > db24: 41 89 c0 mov %eax,%r8d > db27: 31 d2 xor %edx,%edx > db29: 89 de mov %ebx,%esi > db2b: bb ca 00 00 00 mov $0xca,%ebx > db30: 48 89 ef mov %rbp,%rdi > db33: 40 80 f6 80 xor $0x80,%sil > db37: 89 d8 mov %ebx,%eax > db39: 0f 05 syscall > db3b: 89 c3 mov %eax,%ebx > .... > 000000000000db80 <__new_sem_wait_slow.constprop.0>: > db80: 41 54 push %r12 > db82: 48 b8 00 00 00 00 01 movabs $0x100000000,%rax > db89: 00 00 00 > db8c: 55 push %rbp > db8d: 53 push %rbx > db8e: 48 89 fb mov %rdi,%rbx > db91: 48 83 ec 30 sub $0x30,%rsp > db95: f0 48 0f c1 07 lock xadd %rax,(%rdi) > db9a: 48 8d 35 5f ff ff ff lea -0xa1(%rip),%rsi # db00 > <__sem_wait_cleanup> > dba1: 49 bc ff ff ff ff fe movabs $0xfffffffeffffffff,%r12 > dba8: ff ff ff > dbab: 48 8d 6c 24 10 lea 0x10(%rsp),%rbp > dbb0: 48 89 fa mov %rdi,%rdx > dbb3: 48 89 04 24 mov %rax,(%rsp) > dbb7: 48 89 ef mov %rbp,%rdi > dbba: e8 b1 04 00 00 callq e070 <_pthread_cleanup_push> > dbbf: 48 8b 04 24 mov (%rsp),%rax > dbc3: 85 c0 test %eax,%eax > .... > > So os::is_first_C_frame returns earlier. To support walking pthread library, > I don't think it requires huge efforts, though.
@kelthuzadx I do not agree with this enhancement request. I don't think it is the job of jcmd/jstack to do this. Those tools are concerned with application introspection not VM debugging. ------------- PR: https://git.openjdk.java.net/jdk/pull/7833