< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
Print this page
rev 54717 : imported patch 8223306
*** 503,512 ****
--- 503,513 ----
},
new Command("dumpreplaydata", "dumpreplaydata { <address > | -a | <thread_id> }", false) {
// This is used to dump replay data from ciInstanceKlass, ciMethodData etc
// default file name is replay.txt, also if java crashes in compiler
// thread, this file will be dumped in error processing.
+ boolean allThreads = false;
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
return;
}
*** 532,556 ****
usage();
return;
}
}
// Not an address
! boolean all = name.equals("-a");
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
ciEnv env = ct.env();
if (env != null) {
env.dumpReplayData(out);
}
}
}
! }
}
},
new Command("buildreplayjars", "buildreplayjars [ all | app | boot ] | [ prefix ]", false) {
// This is used to dump jar files of all the classes
// loaded in the core. Everything with null classloader
--- 533,556 ----
usage();
return;
}
}
// Not an address
! allThreads = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (allThreads || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
ciEnv env = ct.env();
if (env != null) {
env.dumpReplayData(out);
}
}
}
! });
}
},
new Command("buildreplayjars", "buildreplayjars [ all | app | boot ] | [ prefix ]", false) {
// This is used to dump jar files of all the classes
// loaded in the core. Everything with null classloader
*** 889,909 ****
}
}
},
new Command("dumpideal", "dumpideal { -a | id }", false) {
// Do a full dump of the nodes reachabile from root in each compiler thread.
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! boolean all = name.equals("-a");
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
out.println(ct);
ciEnv env = ct.env();
if (env != null) {
--- 889,909 ----
}
}
},
new Command("dumpideal", "dumpideal { -a | id }", false) {
// Do a full dump of the nodes reachabile from root in each compiler thread.
+ boolean allThreads = false;
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! allThreads = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (allThreads || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
out.println(ct);
ciEnv env = ct.env();
if (env != null) {
*** 912,922 ****
} else {
out.println(" not compiling");
}
}
}
! }
}
}
},
new Command("dumpcfg", "dumpcfg { -a | id }", false) {
// Dump the PhaseCFG for every compiler thread that has one live.
--- 912,922 ----
} else {
out.println(" not compiling");
}
}
}
! });
}
}
},
new Command("dumpcfg", "dumpcfg { -a | id }", false) {
// Dump the PhaseCFG for every compiler thread that has one live.
*** 924,935 ****
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
boolean all = name.equals("-a");
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
--- 924,934 ----
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
boolean all = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
*** 939,949 ****
Compile c = env.compilerData();
c.cfg().dump(out);
}
}
}
! }
}
}
},
new Command("dumpilt", "dumpilt { -a | id }", false) {
// dumps the InlineTree of a C2 compile
--- 938,948 ----
Compile c = env.compilerData();
c.cfg().dump(out);
}
}
}
! });
}
}
},
new Command("dumpilt", "dumpilt { -a | id }", false) {
// dumps the InlineTree of a C2 compile
*** 951,962 ****
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
boolean all = name.equals("-a");
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
--- 950,960 ----
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
boolean all = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
if (all || bos.toString().equals(name)) {
if (thread instanceof CompilerThread) {
CompilerThread ct = (CompilerThread)thread;
*** 968,978 ****
ilt.print(out);
}
}
}
}
! }
}
}
},
new Command("vmstructsdump", "vmstructsdump", false) {
public void doit(Tokens t) {
--- 966,976 ----
ilt.print(out);
}
}
}
}
! });
}
}
},
new Command("vmstructsdump", "vmstructsdump", false) {
public void doit(Tokens t) {
*** 1434,1448 ****
}
String type = t.nextToken();
final Address value = VM.getVM().getDebugger().parseAddress(t.nextToken());
final long stride = VM.getVM().getAddressSize();
if (type.equals("threads")) {
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
Address base = thread.getStackBase();
Address end = thread.getLastJavaSP();
! if (end == null) continue;
if (end.lessThan(base)) {
Address tmp = base;
base = end;
end = tmp;
}
--- 1432,1445 ----
}
String type = t.nextToken();
final Address value = VM.getVM().getDebugger().parseAddress(t.nextToken());
final long stride = VM.getVM().getAddressSize();
if (type.equals("threads")) {
! VM.getVM().getThreads().doJavaThreads((thread) -> {
Address base = thread.getStackBase();
Address end = thread.getLastJavaSP();
! if (end == null) return;
if (end.lessThan(base)) {
Address tmp = base;
base = end;
end = tmp;
}
*** 1454,1464 ****
thread.printThreadIDOn(new PrintStream(bos));
out.println("found on the stack of thread " + bos.toString() + " at " + base);
}
base = base.addOffsetTo(stride);
}
! }
} else if (type.equals("rawheap")) {
RawHeapVisitor iterator = new RawHeapVisitor() {
public void prologue(long used) {
}
--- 1451,1461 ----
thread.printThreadIDOn(new PrintStream(bos));
out.println("found on the stack of thread " + bos.toString() + " at " + base);
}
base = base.addOffsetTo(stride);
}
! });
} else if (type.equals("rawheap")) {
RawHeapVisitor iterator = new RawHeapVisitor() {
public void prologue(long used) {
}
*** 1552,1608 ****
VM.getVM().getCodeCache().iterate(v);
}
}
},
new Command("where", "where { -a | id }", false) {
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! Threads threads = VM.getVM().getThreads();
! boolean all = name.equals("-a");
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (all || bos.toString().equals(name)) {
out.println("Thread " + bos.toString() + " Address: " + thread.getAddress());
HTMLGenerator gen = new HTMLGenerator(false);
try {
out.println(gen.genHTMLForJavaStackTrace(thread));
} catch (Exception e) {
err.println("Error: " + e);
if (verboseExceptions) {
e.printStackTrace(err);
}
}
! if (!all) return;
! }
}
! if (!all) out.println("Couldn't find thread " + name);
}
}
},
new Command("thread", "thread { -a | id }", false) {
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! Threads threads = VM.getVM().getThreads();
! boolean all = name.equals("-a");
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (all || bos.toString().equals(name)) {
out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
thread.printInfoOn(out);
out.println(" ");
! if (!all) return;
}
! }
! if (!all) {
out.println("Couldn't find thread " + name);
}
}
}
},
--- 1549,1605 ----
VM.getVM().getCodeCache().iterate(v);
}
}
},
new Command("where", "where { -a | id }", false) {
+ boolean allThreads = false;
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! allThreads = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (allThreads || bos.toString().equals(name)) {
out.println("Thread " + bos.toString() + " Address: " + thread.getAddress());
HTMLGenerator gen = new HTMLGenerator(false);
try {
out.println(gen.genHTMLForJavaStackTrace(thread));
} catch (Exception e) {
err.println("Error: " + e);
if (verboseExceptions) {
e.printStackTrace(err);
}
}
! if (!allThreads) return;
}
! });
! if (!allThreads) out.println("Couldn't find thread " + name);
}
}
},
new Command("thread", "thread { -a | id }", false) {
+ boolean allThreads = false;
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String name = t.nextToken();
! allThreads = name.equals("-a");
! VM.getVM().getThreads().doJavaThreads((thread) -> {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thread.printThreadIDOn(new PrintStream(bos));
! if (allThreads || bos.toString().equals(name)) {
out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
thread.printInfoOn(out);
out.println(" ");
! if (!allThreads) return;
}
! });
! if (!allThreads) {
out.println("Couldn't find thread " + name);
}
}
}
},
*** 1610,1639 ****
new Command("threads", false) {
public void doit(Tokens t) {
if (t.countTokens() != 0) {
usage();
} else {
! Threads threads = VM.getVM().getThreads();
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
thread.printThreadIDOn(out);
out.println(" " + thread.getThreadName());
thread.printInfoOn(out);
out.println("\n...");
! }
}
}
},
new Command("livenmethods", false) {
public void doit(Tokens t) {
if (t.countTokens() != 0) {
usage();
} else {
ArrayList nmethods = new ArrayList();
- Threads threads = VM.getVM().getThreads();
HTMLGenerator gen = new HTMLGenerator(false);
! for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
try {
for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
if (vf instanceof CompiledVFrame) {
NMethod c = ((CompiledVFrame)vf).getCode();
if (!nmethods.contains(c)) {
--- 1607,1634 ----
new Command("threads", false) {
public void doit(Tokens t) {
if (t.countTokens() != 0) {
usage();
} else {
! VM.getVM().getThreads().doJavaThreads((thread) -> {
thread.printThreadIDOn(out);
out.println(" " + thread.getThreadName());
thread.printInfoOn(out);
out.println("\n...");
! });
}
}
},
new Command("livenmethods", false) {
public void doit(Tokens t) {
if (t.countTokens() != 0) {
usage();
} else {
ArrayList nmethods = new ArrayList();
HTMLGenerator gen = new HTMLGenerator(false);
! VM.getVM().getThreads().doJavaThreads((thread) -> {
try {
for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
if (vf instanceof CompiledVFrame) {
NMethod c = ((CompiledVFrame)vf).getCode();
if (!nmethods.contains(c)) {
*** 1643,1653 ****
}
}
} catch (Exception e) {
e.printStackTrace();
}
! }
}
}
},
new Command("g1regiondetails", false) {
public void doit(Tokens t) {
--- 1638,1648 ----
}
}
} catch (Exception e) {
e.printStackTrace();
}
! });
}
}
},
new Command("g1regiondetails", false) {
public void doit(Tokens t) {
< prev index next >