| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package art; |
| 18 |
|
| 19 |
import java.util.Arrays; |
| 20 |
import java.lang.reflect.Executable; |
| 21 |
import java.lang.reflect.Method; |
| 22 |
|
| 23 |
public class Test994 { |
| 24 |
public static final Breakpoint.Manager MANAGER = new Breakpoint.Manager(); |
| 25 |
public static void doNothing() {} |
| 26 |
|
| 27 |
|
| 28 |
public static void doMultiPath(boolean bit) { |
| 29 |
doNothing(); |
| 30 |
if (bit) { |
| 31 |
System.out.println("\targument was true"); |
| 32 |
} else { |
| 33 |
System.out.println("\targument was false"); |
| 34 |
} |
| 35 |
doNothing(); |
| 36 |
} |
| 37 |
|
| 38 |
public static void notifyBreakpointReached(Thread thr, Executable e, long loc) { |
| 39 |
System.out.println( |
| 40 |
"\tBreakpoint reached: " + e + " @ line=" + Breakpoint.locationToLine(e, loc)); |
| 41 |
} |
| 42 |
|
| 43 |
public static void run() throws Exception { |
| 44 |
|
| 45 |
Breakpoint.stopBreakpointWatch(Thread.currentThread()); |
| 46 |
Breakpoint.startBreakpointWatch( |
| 47 |
Test994.class, |
| 48 |
Test994.class.getDeclaredMethod( |
| 49 |
"notifyBreakpointReached", Thread.class, Executable.class, Long.TYPE), |
| 50 |
Thread.currentThread()); |
| 51 |
|
| 52 |
Method multipath_method = Test994.class.getDeclaredMethod("doMultiPath", Boolean.TYPE); |
| 53 |
|
| 54 |
Breakpoint.LineNumber[] lines = Breakpoint.getLineNumberTable(multipath_method); |
| 55 |
|
| 56 |
|
| 57 |
Arrays.sort(lines); |
| 58 |
|
| 59 |
boolean[] values = new boolean[] { true, false }; |
| 60 |
|
| 61 |
for (Breakpoint.LineNumber line : lines) { |
| 62 |
MANAGER.clearAllBreakpoints(); |
| 63 |
MANAGER.setBreakpoint(multipath_method, line.location); |
| 64 |
for (boolean arg : values) { |
| 65 |
System.out.println("Breaking on line: " + line.line + " calling with arg: " + arg); |
| 66 |
doMultiPath(arg); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
Breakpoint.stopBreakpointWatch(Thread.currentThread()); |
| 71 |
} |
| 72 |
} |