For mounted virtual threads HeapDumper dumps 2 HPROF_GC_ROOT_THREAD_OBJ subrecord.
One of them refers to actual stack trace/stack references, another one has empty stack trace.
test/hotspot/jtreg/serviceability/jvmti/vthread/HeapDump/VThreadInHeapDump.java output contains:
thread 0x8141dda0, 6 frames
- [0] VThreadInHeapDumpTarg$VthreadMounted.run()V (VThreadInHeapDump.java:108)
Java Local Reference: VThreadInHeapDumpTarg$VthreadMounted
Java Local Reference: VThreadInHeapDumpTarg$VThreadMountedReferenced
- [1] java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V (Thread.java:1583)
Java Local Reference: java.lang.VirtualThread
Java Local Reference: java.lang.Class
Java Local Reference: VThreadInHeapDumpTarg$VthreadMounted
- [2] java.lang.VirtualThread.run(Ljava/lang/Runnable;)V (VirtualThread.java:321)
Java Local Reference: java.lang.VirtualThread
Java Local Reference: VThreadInHeapDumpTarg$VthreadMounted
Java Local Reference: java.lang.Class
- [3] java.lang.VirtualThread$VThreadContinuation$1.run()V (VirtualThread.java:201)
Java Local Reference: java.lang.VirtualThread$VThreadContinuation$1
- [4] jdk.internal.vm.Continuation.enter0()V (Continuation.java:320)
Java Local Reference: java.lang.VirtualThread$VThreadContinuation
- [5] jdk.internal.vm.Continuation.enter(Ljdk/internal/vm/Continuation;Z)V (Continuation.java:312)
Java Local Reference: java.lang.VirtualThread$VThreadContinuation
...
thread 0x8141dda0, 0 frames