Add new CLHSDB command to print all methods in CodeCache

Yasumasa Suenaga yasuenag at gmail.com
Tue Jan 3 02:18:54 UTC 2017


Hi all,

I want to check what methods have been compiled in memory dump.
I know we can use dumpcodecache command in CLHSDB, but it is too long fot it because dumpcodecache prints contents (assembly code).

I want to add a command to CLHSDB to print all method name and signature in CodeCache as below.
Is it accepted? If so, I will file it to JBS and will upload webrev.

-------------------------------------------
diff -r 8d23544aa002 src/jdk.hotspot.agent/doc/clhsdb.html
--- a/src/jdk.hotspot.agent/doc/clhsdb.html     Mon Jan 02 00:26:40 2017 -0800
+++ b/src/jdk.hotspot.agent/doc/clhsdb.html     Tue Jan 03 11:16:46 2017 +0900
@@ -46,6 +46,7 @@
    dumpcfg -a | id <font color="red">Dump the PhaseCFG for every compiler thread that has one live</font>
    dumpclass { address | name } [ directory ] <font color="red">dump .class file for given Klass* or class name</font>
    dumpcodecache <font color="red">dump codecache contents</font>
+  listcodecache <font color="red">list methods in codecache</font>
    dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
    dumpideal -a | id <font color="red">dump ideal graph like debug flag -XX:+PrintIdeal</font>
    dumpilt -a | id <font color="red">dump inline tree for C2 compilation</font>
diff -r 8d23544aa002 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java Mon Jan 02 00:26:40 2017 -0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java Tue Jan 03 11:16:46 2017 +0900
@@ -1559,6 +1559,24 @@
                  }
              }
          },
+        new Command("listcodecache", "listcodecache", false) {
+            public void doit(Tokens t) {
+                if (t.countTokens() != 0) {
+                    usage();
+                } else {
+                    CodeCacheVisitor v = new CodeCacheVisitor() {
+                        public void prologue(Address start, Address end) {
+                        }
+                        public void visit(CodeBlob blob) {
+                            blob.printOn(out);
+                        }
+                        public void epilogue() {
+                        }
+                    };
+                    VM.getVM().getCodeCache().iterate(v);
+                }
+            }
+        },
          new Command("where", "where { -a | id }", false) {
              public void doit(Tokens t) {
                  if (t.countTokens() != 1) {
-------------------------------------------


Thanks,

Yasumasa



More information about the serviceability-dev mailing list