Skip to content

Commit 00c0d10

Browse files
committed
8244670: convert clhsdb "whatis" command from javascript to java
Reviewed-by: sspitsyn, kevinw
1 parent fb623f1 commit 00c0d10

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/jdk.hotspot.agent/doc/clhsdb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>Annotated output of CLHSDB help command</h3>
9090
vmstructsdump <font color="red">dump hotspot type library in text</font>
9191
verbose true | false <font color="red">turn on/off verbose mode</font>
9292
versioncheck [ true | false ] <font color="red">turn on/off debuggee VM version check</font>
93-
whatis address <font color="red">print info about any arbitrary address</font>
93+
whatis address <font color="red">print info about any arbitrary address. alias for findpc command</font>
9494
where { -a | id } <font color="red">print Java stack trace of given Java thread or all Java threads (-a)</font>
9595
</code>
9696
</pre>

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,18 @@ public void doit(Tokens t) {
608608
}
609609
}
610610
},
611+
// "whatis" is just an alias for "findpc". It's kept around for compatiblity reasons.
612+
new Command("whatis", "whatis address", false) {
613+
public void doit(Tokens t) {
614+
if (t.countTokens() != 1) {
615+
usage();
616+
} else {
617+
Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
618+
PointerLocation loc = PointerFinder.find(a);
619+
loc.printOn(out);
620+
}
621+
}
622+
},
611623
new Command("symbol", "symbol address", false) {
612624
public void doit(Tokens t) {
613625
if (t.countTokens() != 1) {

test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ private static void testFindPC(boolean withXcomp, boolean withCore) throws Excep
182182
methodAddr));
183183
runTest(withCore, cmds, expStrMap);
184184

185+
// Rerun above findpc command, but this time using "whatis", which is an alias for "findpc".
186+
cmdStr = "whatis " + methodAddr;
187+
cmds = List.of(cmdStr);
188+
expStrMap = new HashMap<>();
189+
expStrMap.put(cmdStr, List.of("Method ",
190+
"LingeredApp.steadyState",
191+
methodAddr));
192+
runTest(withCore, cmds, expStrMap);
193+
185194
// Run findpc on a JavaThread*. We can find one in the jstack output.
186195
// The tid for a thread is it's JavaThread*. For example:
187196
// "main" #1 prio=5 tid=0x00000080263398f0 nid=0x277e0 ...

0 commit comments

Comments
 (0)