8244670: convert clhsdb "whatis" command from javascript to java

Reviewed-by: sspitsyn, kevinw
This commit is contained in:
Chris Plummer 2021-12-21 22:55:09 +00:00
parent fb623f1d2e
commit 00c0d10870
3 changed files with 22 additions and 1 deletions
src/jdk.hotspot.agent
doc
share/classes/sun/jvm/hotspot
test/hotspot/jtreg/serviceability/sa

@ -90,7 +90,7 @@ Available commands:
vmstructsdump <font color="red">dump hotspot type library in text</font>
verbose true | false <font color="red">turn on/off verbose mode</font>
versioncheck [ true | false ] <font color="red">turn on/off debuggee VM version check</font>
whatis address <font color="red">print info about any arbitrary address</font>
whatis address <font color="red">print info about any arbitrary address. alias for findpc command</font>
where { -a | id } <font color="red">print Java stack trace of given Java thread or all Java threads (-a)</font>
</code>
</pre>

@ -608,6 +608,18 @@ public class CommandProcessor {
}
}
},
// "whatis" is just an alias for "findpc". It's kept around for compatiblity reasons.
new Command("whatis", "whatis address", false) {
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
PointerLocation loc = PointerFinder.find(a);
loc.printOn(out);
}
}
},
new Command("symbol", "symbol address", false) {
public void doit(Tokens t) {
if (t.countTokens() != 1) {

@ -182,6 +182,15 @@ public class ClhsdbFindPC {
methodAddr));
runTest(withCore, cmds, expStrMap);
// Rerun above findpc command, but this time using "whatis", which is an alias for "findpc".
cmdStr = "whatis " + methodAddr;
cmds = List.of(cmdStr);
expStrMap = new HashMap<>();
expStrMap.put(cmdStr, List.of("Method ",
"LingeredApp.steadyState",
methodAddr));
runTest(withCore, cmds, expStrMap);
// Run findpc on a JavaThread*. We can find one in the jstack output.
// The tid for a thread is it's JavaThread*. For example:
// "main" #1 prio=5 tid=0x00000080263398f0 nid=0x277e0 ...