jdb, if next is applied, skips next block if there is 'if', 'while' or any other blocks after current line of execution.
To reproduce:
public class test {
static String fnCall(String str) {
return str;
}
public static void main(String[] argv) {
String atr = fnCall("test this");
if (atr.indexOf("th") != 0) {
System.out.println ("\"th\" is inside the string");
} else {
System.out.println ("\"th\" is not inside the string");
}
atr = fnCall("test this");
}
}
Cammands:
stop in test.main
next
Initializing jdb...
> stop in test.main
Deferring breakpoint test.main.
It will be set after the class is loaded.
> run
run test
>
VM Started: Set deferred breakpoint test.main
Breakpoint hit: thread="main", test.main(), line=10, bci=0
10 String atr = fnCall("test this");
main[1] next
"th" is inside the string
main[1]
The application exited
=============
Moved Brad's additions to wetmore-notes attachement.
To reproduce:
public class test {
static String fnCall(String str) {
return str;
}
public static void main(String[] argv) {
String atr = fnCall("test this");
if (atr.indexOf("th") != 0) {
System.out.println ("\"th\" is inside the string");
} else {
System.out.println ("\"th\" is not inside the string");
}
atr = fnCall("test this");
}
}
Cammands:
stop in test.main
next
Initializing jdb...
> stop in test.main
Deferring breakpoint test.main.
It will be set after the class is loaded.
> run
run test
>
VM Started: Set deferred breakpoint test.main
Breakpoint hit: thread="main", test.main(), line=10, bci=0
10 String atr = fnCall("test this");
main[1] next
"th" is inside the string
main[1]
The application exited
=============
Moved Brad's additions to wetmore-notes attachement.
- duplicates
-
JDK-4338898 jdb does not always stop execution at next line with next command
- Closed