Currently we have CDSHeapVerifier::trace_to_root(), which is used only to report incorrectly archived static fields (see JDK-8275731).
We should make this function available for use in general debugging (to be called inside a gdb session, etc).
Example:
Thread 8 "VM Thread" hit Breakpoint 2, HeapShared::check_module_oop (orig_module_obj=0x5ce8bf588)
at heapShared.cpp:1193
1193 assert(DumpSharedSpaces, "must be");
(gdb) call CDSHeapVerifier::trace_to_root(tty, orig_module_obj)
[ 0] {0x00000005ce8bb900} jdk.internal.loader.ArchivedClassLoaders::servicesCatalogs (offset = 24)
[ 1] {0x00000005ce8bba08} [Ljdk.internal.module.ServicesCatalog; @[0]
[ 2] {0x00000005ce8bbb60} jdk.internal.module.ServicesCatalog::map (offset = 12)
[ 3] {0x00000005ce8bbb70} java.util.concurrent.ConcurrentHashMap::table (offset = 40)
[ 4] {0x00000005ce8d9638} [Ljava.util.concurrent.ConcurrentHashMap$Node; @[0]
[ 5] {0x00000005ce8d9bc0} java.util.concurrent.ConcurrentHashMap$Node::val (offset = 20)
[ 6] {0x00000005ce8d9b78} java.util.concurrent.CopyOnWriteArrayList::array (offset = 16)
[ 7] {0x00000005ce8d9ba0} [Ljava.lang.Object; @[0]
[ 8] {0x00000005ce8d9b30} jdk.internal.module.ServicesCatalog$ServiceProvider::module (offset = 12)
[ 9] {0x00000005ce8bf588} java.lang.Module
We should make this function available for use in general debugging (to be called inside a gdb session, etc).
Example:
Thread 8 "VM Thread" hit Breakpoint 2, HeapShared::check_module_oop (orig_module_obj=0x5ce8bf588)
at heapShared.cpp:1193
1193 assert(DumpSharedSpaces, "must be");
(gdb) call CDSHeapVerifier::trace_to_root(tty, orig_module_obj)
[ 0] {0x00000005ce8bb900} jdk.internal.loader.ArchivedClassLoaders::servicesCatalogs (offset = 24)
[ 1] {0x00000005ce8bba08} [Ljdk.internal.module.ServicesCatalog; @[0]
[ 2] {0x00000005ce8bbb60} jdk.internal.module.ServicesCatalog::map (offset = 12)
[ 3] {0x00000005ce8bbb70} java.util.concurrent.ConcurrentHashMap::table (offset = 40)
[ 4] {0x00000005ce8d9638} [Ljava.util.concurrent.ConcurrentHashMap$Node; @[0]
[ 5] {0x00000005ce8d9bc0} java.util.concurrent.ConcurrentHashMap$Node::val (offset = 20)
[ 6] {0x00000005ce8d9b78} java.util.concurrent.CopyOnWriteArrayList::array (offset = 16)
[ 7] {0x00000005ce8d9ba0} [Ljava.lang.Object; @[0]
[ 8] {0x00000005ce8d9b30} jdk.internal.module.ServicesCatalog$ServiceProvider::module (offset = 12)
[ 9] {0x00000005ce8bf588} java.lang.Module