The jdb "clear" and "stop" commands (with no arguments) are used list all breakpoints. However, the only info provided is the location. For example:
main[1] clear
Breakpoints set:
breakpoint Test.main
breakpoint Test:10
There is other info associated with the breakpoint that might also be useful to display. For example the suspension policy and the thread filter. With the following code added to BreakpointSpec.toString():
if (suspendPolicy == EventRequest.SUSPEND_ALL) {
sb.append(" (suspend all)");
} else if (suspendPolicy == EventRequest.SUSPEND_NONE) {
sb.append(" (suspend none)");
} else if (suspendPolicy == EventRequest.SUSPEND_EVENT_THREAD) {
sb.append(" (suspend thread)");
}
if (threadFilter != null) {
sb.append(" (threadid " + threadFilter.uniqueID() + ")");
}
return MessageOutput.format("breakpoint", sb.toString());
The output would look like:
main[1] clear
Breakpoints set:
breakpoint Test.main (suspend all) (threadid 1)
breakpoint Test:10 (suspend thread)
A further improvement would be to give each breakpoint a unique numeric ID when created, similar to what gdb does. The ID could be included with the breakpoint list:
main[1] clear
Breakpoints set:
1 breakpoint Test.main (suspend all)
2 breakpoint Test:10 (suspend thread) (threadid 1)
And then clear could be modified to accept a breakpoint ID, making it much easier for the user to clear breakpoints. For example, instead of needing to type:
main[1] clear Test.main
All that is needed is:
main[1] clear 1
We could also print the id when the breakpoint is created. For example:
main[1] stop in Test.main
Set breakpoint Test.main
Could become:
main[1] stop in Test.main
Set breakpoint 1 Test.main
This is just another way for the user to get the breakpoint ID.
It's possible that any of these changes could cause issues with existing tests or even user scripts.
main[1] clear
Breakpoints set:
breakpoint Test.main
breakpoint Test:10
There is other info associated with the breakpoint that might also be useful to display. For example the suspension policy and the thread filter. With the following code added to BreakpointSpec.toString():
if (suspendPolicy == EventRequest.SUSPEND_ALL) {
sb.append(" (suspend all)");
} else if (suspendPolicy == EventRequest.SUSPEND_NONE) {
sb.append(" (suspend none)");
} else if (suspendPolicy == EventRequest.SUSPEND_EVENT_THREAD) {
sb.append(" (suspend thread)");
}
if (threadFilter != null) {
sb.append(" (threadid " + threadFilter.uniqueID() + ")");
}
return MessageOutput.format("breakpoint", sb.toString());
The output would look like:
main[1] clear
Breakpoints set:
breakpoint Test.main (suspend all) (threadid 1)
breakpoint Test:10 (suspend thread)
A further improvement would be to give each breakpoint a unique numeric ID when created, similar to what gdb does. The ID could be included with the breakpoint list:
main[1] clear
Breakpoints set:
1 breakpoint Test.main (suspend all)
2 breakpoint Test:10 (suspend thread) (threadid 1)
And then clear could be modified to accept a breakpoint ID, making it much easier for the user to clear breakpoints. For example, instead of needing to type:
main[1] clear Test.main
All that is needed is:
main[1] clear 1
We could also print the id when the breakpoint is created. For example:
main[1] stop in Test.main
Set breakpoint Test.main
Could become:
main[1] stop in Test.main
Set breakpoint 1 Test.main
This is just another way for the user to get the breakpoint ID.
It's possible that any of these changes could cause issues with existing tests or even user scripts.
- relates to
-
JDK-8219143 jdb should support breakpoint thread filters
-
- Resolved
-