Mercurial > hg > graal-jvmci-8
changeset 23469:c1679cc87ba0 jdk8u76-b01
8140031: SA: Searching for a value in Threads does not work
Summary: Improve the thread and threads commands in CLHSDB
Reviewed-by: dsamersoff
author | poonam |
---|---|
date | Wed, 09 Dec 2015 10:26:00 -0800 |
parents | a045a14d1c81 |
children | 1812b99073ac 70649f10b88c f796867c1bcb |
files | agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Tue Dec 08 15:05:09 2015 +0000 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Wed Dec 09 10:26:00 2015 -0800 @@ -1446,7 +1446,7 @@ if (type.equals("threads")) { Threads threads = VM.getVM().getThreads(); for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) { - Address base = thread.getBaseOfStackPointer(); + Address base = thread.getStackBase(); Address end = thread.getLastJavaSP(); if (end == null) continue; if (end.lessThan(base)) { @@ -1454,11 +1454,13 @@ base = end; end = tmp; } - out.println("Searching " + base + " " + end); + //out.println("Searching " + base + " " + end); while (base != null && base.lessThan(end)) { Address val = base.getAddressAt(0); if (AddressOps.equal(val, value)) { - out.println(base); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + thread.printThreadIDOn(new PrintStream(bos)); + out.println("found on the stack of thread " + bos.toString() + " at " + base); } base = base.addOffsetTo(stride); } @@ -1601,6 +1603,8 @@ 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; } } @@ -1618,6 +1622,8 @@ for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) { thread.printThreadIDOn(out); out.println(" " + thread.getThreadName()); + thread.printInfoOn(out); + out.println("\n..."); } } }
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Tue Dec 08 15:05:09 2015 +0000 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Wed Dec 09 10:26:00 2015 -0800 @@ -415,7 +415,7 @@ } else { tty.println("No Java frames present"); } - tty.println("Base of Stack: " + getBaseOfStackPointer()); + tty.println("Base of Stack: " + getStackBase()); tty.println("Last_Java_SP: " + getLastJavaSP()); tty.println("Last_Java_FP: " + getLastJavaFP()); tty.println("Last_Java_PC: " + getLastJavaPC());