提交 16398e0a 编写于 作者: P poonam

8140031: SA: Searching for a value in Threads does not work

Summary: Improve the thread and threads commands in CLHSDB
Reviewed-by: dsamersoff
上级 d6ea363e
...@@ -1446,7 +1446,7 @@ public class CommandProcessor { ...@@ -1446,7 +1446,7 @@ public class CommandProcessor {
if (type.equals("threads")) { if (type.equals("threads")) {
Threads threads = VM.getVM().getThreads(); Threads threads = VM.getVM().getThreads();
for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) { for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
Address base = thread.getBaseOfStackPointer(); Address base = thread.getStackBase();
Address end = thread.getLastJavaSP(); Address end = thread.getLastJavaSP();
if (end == null) continue; if (end == null) continue;
if (end.lessThan(base)) { if (end.lessThan(base)) {
...@@ -1454,11 +1454,13 @@ public class CommandProcessor { ...@@ -1454,11 +1454,13 @@ public class CommandProcessor {
base = end; base = end;
end = tmp; end = tmp;
} }
out.println("Searching " + base + " " + end); //out.println("Searching " + base + " " + end);
while (base != null && base.lessThan(end)) { while (base != null && base.lessThan(end)) {
Address val = base.getAddressAt(0); Address val = base.getAddressAt(0);
if (AddressOps.equal(val, value)) { 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); base = base.addOffsetTo(stride);
} }
...@@ -1601,6 +1603,8 @@ public class CommandProcessor { ...@@ -1601,6 +1603,8 @@ public class CommandProcessor {
thread.printThreadIDOn(new PrintStream(bos)); thread.printThreadIDOn(new PrintStream(bos));
if (all || bos.toString().equals(name)) { if (all || bos.toString().equals(name)) {
out.println("Thread " + bos.toString() + " Address " + thread.getAddress()); out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
thread.printInfoOn(out);
out.println(" ");
if (!all) return; if (!all) return;
} }
} }
...@@ -1618,6 +1622,8 @@ public class CommandProcessor { ...@@ -1618,6 +1622,8 @@ public class CommandProcessor {
for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) { for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
thread.printThreadIDOn(out); thread.printThreadIDOn(out);
out.println(" " + thread.getThreadName()); out.println(" " + thread.getThreadName());
thread.printInfoOn(out);
out.println("\n...");
} }
} }
} }
......
...@@ -415,7 +415,7 @@ public class JavaThread extends Thread { ...@@ -415,7 +415,7 @@ public class JavaThread extends Thread {
} else { } else {
tty.println("No Java frames present"); 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_SP: " + getLastJavaSP());
tty.println("Last_Java_FP: " + getLastJavaFP()); tty.println("Last_Java_FP: " + getLastJavaFP());
tty.println("Last_Java_PC: " + getLastJavaPC()); tty.println("Last_Java_PC: " + getLastJavaPC());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册