< prev index next >
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
Print this page
*** 98,107 ****
--- 98,118 ----
@Override
public void breakpointEvent(BreakpointEvent be) {
Thread.yield(); // fetch output
MessageOutput.lnprint("Breakpoint hit:");
+ // Print breakpoint location and prompt if suspend policy is
+ // SUSPEND_NONE or SUSPEND_EVENT_THREAD. In case of SUSPEND_ALL
+ // policy this is handled by vmInterrupted() method.
+ int suspendPolicy = be.request().suspendPolicy();
+ switch (suspendPolicy) {
+ case EventRequest.SUSPEND_EVENT_THREAD:
+ case EventRequest.SUSPEND_NONE:
+ printBreakpointLocation(be);
+ MessageOutput.printPrompt();
+ break;
+ }
}
@Override
public void fieldWatchEvent(WatchpointEvent fwe) {
Field field = fwe.field();
*** 225,234 ****
--- 236,249 ----
MessageOutput.println("location",
new Object [] {threadName,
Commands.locationString(loc)});
}
+ private void printBreakpointLocation(BreakpointEvent be) {
+ printLocationWithSourceLine(be.thread().name(), be.location());
+ }
+
private void printCurrentLocation() {
ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
StackFrame frame;
try {
frame = threadInfo.getCurrentFrame();
*** 237,248 ****
return;
}
if (frame == null) {
MessageOutput.println("No frames on the current call stack");
} else {
! Location loc = frame.location();
! printBaseLocation(threadInfo.getThread().name(), loc);
// Output the current source line, if possible
if (loc.lineNumber() != -1) {
String line;
try {
line = Env.sourceLine(loc, loc.lineNumber());
--- 252,268 ----
return;
}
if (frame == null) {
MessageOutput.println("No frames on the current call stack");
} else {
! printLocationWithSourceLine(threadInfo.getThread().name(), frame.location());
! }
! MessageOutput.println();
! }
!
! private void printLocationWithSourceLine(String threadName, Location loc) {
! printBaseLocation(threadName, loc);
// Output the current source line, if possible
if (loc.lineNumber() != -1) {
String line;
try {
line = Env.sourceLine(loc, loc.lineNumber());
*** 254,265 ****
new Object [] {loc.lineNumber(),
line});
}
}
}
- MessageOutput.println();
- }
private void printLocationOfEvent(LocatableEvent theEvent) {
printBaseLocation(theEvent.thread().name(), theEvent.location());
}
--- 274,283 ----
< prev index next >