< prev index next >
test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java
Print this page
*** 22,31 ****
--- 22,32 ----
*/
package lib.jdb;
import java.util.Arrays;
+ import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Represents list of commands of <code>jdb</code> from JDK1.4:
*
*** 116,135 ****
--- 117,143 ----
* in user.home or user.dir
*/
public class JdbCommand {
final String cmd;
boolean allowExit = false;
+ // Default pattern to wait for command to complete
+ Pattern waitForPattern = Jdb.PROMPT_REGEXP;
public JdbCommand(String cmd) {
this.cmd = cmd;
}
public JdbCommand allowExit() {
allowExit = true;
return this;
}
+ public JdbCommand waitForPrompt(String pattern, boolean isMultiline) {
+ waitForPattern = Pattern.compile(pattern, isMultiline ? Pattern.MULTILINE : 0);
+ return this;
+ }
+
public static JdbCommand run(String ... params) {
return new JdbCommand("run " + Arrays.stream(params).collect(Collectors.joining(" ")));
}
public static JdbCommand cont() {
*** 143,156 ****
return new JdbCommand("quit").allowExit();
}
public static JdbCommand stopAt(String targetClass, int lineNum) {
return new JdbCommand("stop at " + targetClass + ":" + lineNum);
}
public static JdbCommand stopIn(String targetClass, String methodName) {
return new JdbCommand("stop in " + targetClass + "." + methodName);
}
!
// clear <class id>:<line> -- clear a breakpoint at a line
public static JdbCommand clear(String targetClass, int lineNum) {
return new JdbCommand("clear " + targetClass + ":" + lineNum);
}
--- 151,172 ----
return new JdbCommand("quit").allowExit();
}
public static JdbCommand stopAt(String targetClass, int lineNum) {
return new JdbCommand("stop at " + targetClass + ":" + lineNum);
}
+ public static JdbCommand stopThreadAt(String targetClass, int lineNum) {
+ return new JdbCommand("stop thread at " + targetClass + ":" + lineNum);
+ }
+ public static JdbCommand stopGoAt(String targetClass, int lineNum) {
+ return new JdbCommand("stop go at " + targetClass + ":" + lineNum);
+ }
public static JdbCommand stopIn(String targetClass, String methodName) {
return new JdbCommand("stop in " + targetClass + "." + methodName);
}
! public static JdbCommand thread(int threadNumber) {
! return new JdbCommand("thread " + threadNumber);
! }
// clear <class id>:<line> -- clear a breakpoint at a line
public static JdbCommand clear(String targetClass, int lineNum) {
return new JdbCommand("clear " + targetClass + ":" + lineNum);
}
< prev index next >