< prev index next >
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
Print this page
@@ -98,10 +98,16 @@
@Override
public void breakpointEvent(BreakpointEvent be) {
Thread.yield(); // fetch output
MessageOutput.lnprint("Breakpoint hit:");
+ // Print current location and prompt if suspend policy is SUSPEND_EVENT_THREAD.
+ // In case of SUSPEND_ALL policy this is handled by vmInterrupted() method.
+ if (be.request().suspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD) {
+ printCurrentLocation(ThreadInfo.getThreadInfo(be.thread()));
+ MessageOutput.printPrompt();
+ }
}
@Override
public void fieldWatchEvent(WatchpointEvent fwe) {
Field field = fwe.field();
@@ -225,12 +231,11 @@
MessageOutput.println("location",
new Object [] {threadName,
Commands.locationString(loc)});
}
- private void printCurrentLocation() {
- ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
+ private void printCurrentLocation(ThreadInfo threadInfo) {
StackFrame frame;
try {
frame = threadInfo.getCurrentFrame();
} catch (IncompatibleThreadStateException exc) {
MessageOutput.println("<location unavailable>");
@@ -257,10 +262,14 @@
}
}
MessageOutput.println();
}
+ private void printCurrentLocation() {
+ printCurrentLocation(ThreadInfo.getCurrentThreadInfo());
+ }
+
private void printLocationOfEvent(LocatableEvent theEvent) {
printBaseLocation(theEvent.thread().name(), theEvent.location());
}
void help() {
< prev index next >