RFR: 8298524: Debug function to trace reachability of CDS archived heap objects

Ioi Lam iklam at openjdk.org
Mon Dec 12 07:48:40 UTC 2022


Please review this small change to help debugging the CDS heap archiving code. 

Here's an example in gdb that shows how the `java.lang.Module` object at `0x00000005ce8d9ba0` is reached from the root (`ArchivedClassLoaders::servicesCatalogs `)


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

-------------

Commit messages:
 - 8298524: Debug function to trace reachability of CDS archived heap objects

Changes: https://git.openjdk.org/jdk/pull/11628/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11628&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298524
  Stats: 30 lines in 2 files changed: 12 ins; 1 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/11628.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11628/head:pull/11628

PR: https://git.openjdk.org/jdk/pull/11628


More information about the hotspot-runtime-dev mailing list