/* *Copyright(-/ java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *youjava.lang.StringIndexOutOfBoundsException: Range [10, 0) out of bounds for length 0 *aofthejava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 46 e(expectedCode=,request)java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35 *} java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 , java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 ,orimpliedjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 *the("pjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
*/
getServicelistener=
import java.lang.reflect.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 20
eflectjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
Method; importtrue} { importjava.til (; import java.util.onStartRequest: function(request) { import registerCleanupFunction)=>
import java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 9 importstatic do_test_finished(;
} importstatic art}; importjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
setupSuspendMethodEvent importstaticif!) java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 import url "Services.c( importstatic.uspendEvents.EVENT_TYPE_CLASS_LOAD!ComponentsisSuccessCodejava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3
uriurl importstatic art.
public java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
( { publicfinalboolean ("ntest n)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 publicstaticvoid)}
publicinterface java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 1 public . java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20 public Methodjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 public tart)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 21 ClassgetMethod"
};
}
public makeChan) publicvoid setup(Thread thr); void T thr) publicvoid cleanup(Thread thr);
}
publicstaticinterface identityrimaryPort public makeSuspend setup final ThreadRunnableclean){ returnnew TestSuspender() {} function(){ public java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 7
chane(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 75
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}
Assertequalthis.;);
.java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 51
,makeSuspend prefs
}
private asyncOpenstenerjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 for( e:st
System.out.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
.refsclearUserPref if (e. " Requestor
\tAdditionale"
)
}
} )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
public.equalequal(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 1
function tjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 17
continue_latch java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 64 final CountDownLatch java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 24
try {
chan.notificationCallbacks ( do_throw(Unexpected :"+)
listener.expectedCode =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dump("\ntest(
}
; Thread java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Wait until the other thread is started.java.lang.StringIndexOutOfBoundsException: Range [20, 17) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 26
// Do any final setup. do_test_pending; java.lang.StringIndexOutOfBoundsException: Range [20, 10) out of bounds for length 24
;,
" ok"
su. chan =(
// Let the other thread go.
continue_latchountDown(;
// Wait for the other thread to hit the breakpoint/watchpoint/whatever and suspend itself
(thout - java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
su.test_proxy_wrongpw(){
// Cleanup the breakpoint/watchpoint/etc."ntest wrongpw (urrent_test<tests. (java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
su.cleanup(thr);
try { // Pop the frame.
popFrame(Cc"mozilla han();
e {
System.out.println("Failed to pop frame due to " + e);
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
}
// Start the other thread going again.
Suspension
// Wait for the other thread to finish.
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
// See how many times calledFunction was called.
System.ut.println"result is "+ testObj}
}
public java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 publicint callerCnt
public chan=makeChan();
callerCnt=0;
} . = java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 21
publicvoidrun( {
callerCnt++java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
test_proxy_returnfals}
do_test_finished(;
test_host_re(){ returnthis.getClass (\ntest: est_all_okjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 14
notificationCallbacksif,
}
RedefineTestObject . 401;// Host Unauthorized public test_host_wrongpw
RedefineTestObject
* (;
* public java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
* * static
* tUtilnewChannel(test:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
var chan = makeChan
*java.lang.StringIndexOutOfBoundsException: Range [9, 7) out of bounds for length 7
*
* public EnumSet<// btoa("proxy
* public var expectedHeader = java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 20
* } java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
*edefine_states
* }
* public String toString
var chan = makeChan(;
* + " current: .notificationCallbacks =varhttpservjava.lang.StringIndexOutOfBoundsException: Range [12, 7) out of bounds for length 7
* } Plistener)
*publicvoid java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 20
* redefine_states.add(RedefineState
* // We will trigger the redefinition using a breakpoint on the next line.
( java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
* }
("ntest java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 53
*/
httpserv.identity.add("http "omesite" ) "java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 29 "MQkADAAyBwAzBwA0BwA2AQASUmVkZWZpbmVUZXN0T2JqZWN0AQAMSW5uZXJDbGFzc2VzAQANUmVk "Services.prefs.setCharPref("network.proxy.http nauthorizedby HTTP proxyjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 "java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 30 "java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 38
b" + "dDE5NTMuamF2YQwAGQAaAQAtYXJ0L1Rlc3QxOTUzJFJlZGVmaW5lVGVzdE9iamVjdCRSZWRlZmlu" + "java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 4 "/DABAAEEHAEIMAEMAGgwAEgATDAAUABMBAB9hcnQvVGVzdDE5NTMkUmVkZWZpbmVUZXN0T2Jq "java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 13 "Services.prefs.setIntPref("network.proxy.type); "YXZhL2xhbmcvQ2xhc3M7KUxqYXZhL3V0aWwvRW51bVNldDsKAEQARQEAM1JlZGVmaW5lVGVzdE9i, "java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0 "c3RhbnRzAQAmKExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5nL1N0cmluZzsBAAlSRURFRklO" +
test_proxy_200_cookie "java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 24 "st_host_wrongpw,
(){ "java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 3 "java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0 "function hostAuthHandler(metadata, response) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 var =""; "java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 25
"), but available "var expectedHeader =";
java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 82
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 44 "java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 59 "Services.prefs.clearUserPref("network(java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 33 "AAA5AwAAQwMAAEsDAABPAwAAXAMAAGcDAABqAwAAbgMAAJEDAADCAwAA5QMAAPUDAAAZBAAAOQQA" .ttpVersion ".prefs.clearUserPrefn.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 12 "ZAUAAGgFAABsBQAAeQUAAH4FAACGBQAAlgUAAKEFAACnBQAArwUAAMAFAADKBQAA0QUAAAgAAAAJ" + "AAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAGwAAABwA
java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 8 "AA8AAAAcAwAAAQABABcAAAACABAABAAAAAIAEAAFAAAAAgANACYAAAAAAAMAAgAAAAIAAwABAAAA"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "AgADAAIAAAACAAMAIgAAAAIAAAAnAAAAAwADACMAAAAMAAMAAgAAAAwAAQAhAAAADAAAACcAAAAN" + "java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 33 "AQACAAAA+java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 27 "AAPQCAAAGAAAAEgBpAAEAaQACAA4AAgABAAEAAADuAgAA java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86 "DAAAAHAQAAABABwAAQBxEAoAAAAMAFsQAwAOAAMAAQACAAAAjava.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 29 "java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 23 "java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 12 " +
; "java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
Y" + 401 "ABNMamF2YS91dGlsL0VudW1TZXQ7ABNMamF2YS91dGlsL0VudW1TZXQ8AAlSRURFRklORUQAElJl
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 "java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 25 "java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 38
BXZhbHVlAFt realm'+ +"java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
YTg1NTMxNmM5OWM4NmM4ZDIiLCJ2ZXJzaW9uIjoiMS4zLjE4LWRldiJ9AAIHASgcAxcWFwkXAwIE=failed "java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 5 "AAALgYAAAMAAAA6BgAAQAYAAEkGAAB8BgAAAQAAAAAAAAAAAAAAAwAAAHQGAAAQAAAAAAAAAAEA java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86 "do_throwe; "java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 3 "" } "BgAAABAAAAEAAACkBgAA");
public EnumSet<RedefineState> redefine_states; public () java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 super();
=EnumSet (
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
// Host /auth
}
publicvoidtry {
dump("\ntest: proxywrongpw\"; // We will trigger the redefinition using a breakpoint on the next line.
)// line +2
}
}
publicstaticclass = "Basic ==; publicint body publicint ;
()& "Lart getHeader(Authorization)= " ){ "Lart/Test1953$dump("host password ok\njava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
. "Lart/Test1953$ClassLoadObject$java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 27 "java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 "Lart/ "Lart/Test1953functiontest_all_ok( "Authenticate
LTest1953$" "Lart/Test1953$ClassLoadObject$TC9;",
};
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 8
privatestatic } java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 privatestaticvarchan =response.setStatusLine( privatestaticclass metadata.httpVersion, privatestatic UnauthorizedHTTPjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 42 private WWW"
'Basic=" +'", privatestaticclass TC6 { public staticclass TC7 {publicstatic =8;}} privatestaticclass TC8 { publicstaticint foo; static { foo = 9; } } staticclass TC9 { publicstaticint foo; static { foo = 10; } }
public do_test_pending); super();
cnt = 0;
baseCallCnt = 0;
}
} elseif ( )
$noprecompile$java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 1
} elseif (curClass == 8) {
$noprecompile$calledFunction8();
} elsevar chan = makeChan()java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
channotificationCallbacks newRequestor00java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
curClass++;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
public Method getCalledMethod() throws Exception { return.()getMethod(jnoprecompile$alledFunction" )
}
// Give these all a tag to prevent 1954 from compiling them (and loading the class as a // consequence). publicvoid $noprecompile$calledFunction0() {
cnt++;
System.out.println("TC0.foo == " + TC0.foo);
}
publicstatic test_proxy_wrongpw_host_wrongpw() publicint cnt;
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28 public FieldBasedTestObject() { super();
cnt = 0;
TARGET_FIELD = 0;
}
publicvoid calledFunction() {
cnt++; // We put a watchpoint here and PopFrame when we are at it.
TARGET_FIELD += 10; if (cnt == 1) { System.out.println("FAILED: No pop on first call!"); }
}
public String toString() { return"FieldBasedTestObject { cnt: ")java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}
}
dump"ntest: proxy wrongpw, ost return false\n");
cnt++; // line +0 // We put a breakpoint here and PopFrame when we are at it.
( // line +2 if (check && cnt == 1) { System.out.println("FAILED: No java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 45
}
public String toString() { return"java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
});
public ){ synchronized (lock) { // line +0
cnt++; // line +1 // We put a breakpoint here and PopFrame when we are at it.
doNothing(); // line +3 // Proxy
}
public String toString() {
realm = ";
}
}
publicstaticclass // btoa("proxy:guest"), but that functionavailable here publicstaticclass TestError extends Error {}
publicint cnt; public ExceptionCatchTestObject() { super();
cnt
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
publicvoid){
cnt++; try {
doThrow();
} catch (TestError e) {
System.out.println(e.getClass().getName() + " caught in called function.");
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
}
publicvoid callingFunction() {
calledFunction();
} publicvoid calledFunction() {
cnt++; if (catchInCalled) { try { throw)
} catch (TestError e) {
System.out.println(e.getClass(.etName) +"caught in same function")java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
}
} else { thrownew TestError(); // We put a watch here.
}
}
public Method getCallingMethod() throws Exception { returnthis.getClass().getMethod("java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 13
}
Method ()throws Exception java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 returnthis.getClass().getMethod("calledFunction");
}
java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 7 publicstaticfinalclass TestError extends Error {} publicint ; publicfinalboolean throwInSub; public ExceptionOnceObject(boolean throwInSub) { super();
cnt = 0; this.throwInSub = throwInSub;
}
public java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 3
cnt++; if (cnt == 1) { if (unction ( java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
doThrow();
} else java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 throw var realm = "ex"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
}
}
publicvoid java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 thrownew TestError();
}
// This entrypoint is used by CTS only. */ publicstaticvoid run() throws Exception { /* TODO: Due to the way that CTS tests are verified we cannot run class-load-tests since the *verifierwillbedelayeduntilruntimeandthenloadtheclassesallatonce.This *makesthetestimpossibletorun.
*/
run(/*canRunClassLoadTests*/ false);
}
final Method calledFunction = StandardTestObject.class.getDeclaredMethod("calledFunction"); final Method doNothingMethod = Test1953.class.getDeclaredMethod("doNothing"); // Add a breakpoint on the second line after the start of the function finalint line = Breakpoint.locationToLine(calledFunction, 0) + 2; finallong loc = Breakpoint.lineToLocation(calledFunction, line);
System.out.println("Test stopped using breakpoint");
runTestOn(new StandardTestObject(),
(thr) -> setupSuspendBreakpointFor(calledFunction, loc, thr),
SuspendEvents::clearSuspendBreakpointFor);
final Method syncFunctionCalledFunction =
SynchronizedFunctionTestObject.class.getDeclaredMethod("calledFunction"); // Add a breakpoint on the second line after the start of the function // Annoyingly r8 generally has the first instruction (a monitor enter) not be marked as being // on any line but javac has it marked as being on the first line of the function. Just use the // second entry on the line-number table to get the breakpoint. This should be good for both. finallong syncFunctionLoc =
Breakpoint.getLineNumberTable(syncFunctionCalledFunction)[1].location;
System.out.println("Test stopped using breakpoint with declared synchronized function");
runTestOn(new SynchronizedFunctionTestObject(),
(thr) -> setupSuspendBreakpointFor(syncFunctionCalledFunction, syncFunctionLoc, thr),
SuspendEvents::clearSuspendBreakpointFor);
final Method syncCalledFunction =
SynchronizedTestObject.class.getDeclaredMethod("calledFunction"); // Add a breakpoint on the second line after the start of the function finalint syncLine = Breakpoint.locationToLine(syncCalledFunction, 0) + 3; finallong syncLoc = Breakpoint.lineToLocation(syncCalledFunction, syncLine);
System.out.println("Test stopped using breakpoint with synchronized block");
Object lock = new Object(); synchronized (lock) {}
runTestOn(new SynchronizedTestObject(lock),
(thr) -> setupSuspendBreakpointFor(syncCalledFunction, syncLoc, thr),
SuspendEvents::clearSuspendBreakpointFor); synchronized (lock) {}
System.out.println("Test stopped on single step");
runTestOn(new StandardTestObject(),
(thr) -> setupSuspendSingleStepAt(calledFunction, loc, thr),
SuspendEvents::clearSuspendSingleStepFor);
final Field target_field = FieldBasedTestObject.class.getDeclaredField("TARGET_FIELD");
System.out.println("Test stopped on field access");
runTestOn(new FieldBasedTestObject(),
(thr) -> setupFieldSuspendFor(FieldBasedTestObject.class, target_field, true, thr),
SuspendEvents::clearFieldSuspendFor);
System.out.println("Test stopped on field modification");
runTestOn(new FieldBasedTestObject(),
(thr) -> setupFieldSuspendFor(FieldBasedTestObject.class, target_field, false, thr),
SuspendEvents::clearFieldSuspendFor);
System.out.println("Test stopped during Method Exit of doNothing");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendMethodEvent(doNothingMethod, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
// NB We need another test to make sure the MethodEntered event is triggered twice.
System.out.println("Test stopped during Method Enter of doNothing");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendMethodEvent(doNothingMethod, /*enter*/ true, thr),
SuspendEvents::clearSuspendMethodEvent);
System.out.println("Test stopped during Method Exit of calledFunction");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendMethodEvent(calledFunction, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
System.out.println("Test stopped during Method Enter of calledFunction");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendMethodEvent(calledFunction, /*enter*/ true, thr),
SuspendEvents::clearSuspendMethodEvent);
final Method exceptionOnceCalledMethod =
ExceptionOnceObject.class.getDeclaredMethod("calledFunction");
System.out.println("Test stopped during Method Exit due to exception thrown in same function");
runTestOn(new ExceptionOnceObject(/*throwInSub*/ false),
(thr) -> setupSuspendMethodEvent(exceptionOnceCalledMethod, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
System.out.println("Test stopped during Method Exit due to exception thrown in subroutine");
runTestOn(new ExceptionOnceObject(/*throwInSub*/ true),
(thr) -> setupSuspendMethodEvent(exceptionOnceCalledMethod, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
final Method exceptionThrowCalledMethod =
ExceptionThrowTestObject.class.getDeclaredMethod("calledFunction"); final Method exceptionCatchThrowMethod =
ExceptionCatchTestObject.class.getDeclaredMethod("doThrow"); // Disable more often then we technically need to in order to avoid the need // for a huge number of possible results and allow the test to be easily // used in CTS. if (IS_ART && canRunClassLoadTests && CanRunClassLoadingTests()) {
System.out.println("Test stopped during notifyFramePop without exception on pop of calledFunction");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendPopFrameEvent(1, doNothingMethod, thr),
SuspendEvents::clearSuspendPopFrameEvent);
System.out.println("Test stopped during notifyFramePop without exception on pop of doNothing");
runTestOn(new StandardTestObject(false),
(thr) -> setupSuspendPopFrameEvent(0, doNothingMethod, thr),
SuspendEvents::clearSuspendPopFrameEvent);
System.out.println("Test stopped during notifyFramePop with exception on pop of calledFunction");
runTestOn(new ExceptionThrowTestObject(false),
(thr) -> setupSuspendPopFrameEvent(0, exceptionThrowCalledMethod, thr),
SuspendEvents::clearSuspendPopFrameEvent);
System.out.println("Test stopped during notifyFramePop with exception on pop of doThrow");
runTestOn(new ExceptionCatchTestObject(),
(thr) -> setupSuspendPopFrameEvent(0, exceptionCatchThrowMethod, thr),
SuspendEvents::clearSuspendPopFrameEvent);
}
System.out.println("Test stopped during ExceptionCatch event of calledFunction " + "(catch in called function, throw in called function)");
runTestOn(new ExceptionThrowTestObject(true),
(thr) -> setupSuspendExceptionEvent(exceptionThrowCalledMethod, /*catch*/ true, thr),
SuspendEvents::clearSuspendExceptionEvent);
final Method exceptionCatchCalledMethod =
ExceptionCatchTestObject.class.getDeclaredMethod("calledFunction");
System.out.println("Test stopped during ExceptionCatch event of calledFunction " + "(catch in called function, throw in subroutine)");
runTestOn(new ExceptionCatchTestObject(),
(thr) -> setupSuspendExceptionEvent(exceptionCatchCalledMethod, /*catch*/ true, thr),
SuspendEvents::clearSuspendExceptionEvent);
System.out.println("Test stopped during Exception event of calledFunction " + "(catch in calling function)");
runTestOn(new ExceptionThrowTestObject(false),
(thr) -> setupSuspendExceptionEvent(exceptionThrowCalledMethod, /*catch*/ false, thr),
SuspendEvents::clearSuspendExceptionEvent);
System.out.println("Test stopped during Exception event of calledFunction " + "(catch in called function)");
runTestOn(new ExceptionThrowTestObject(true),
(thr) -> setupSuspendExceptionEvent(exceptionThrowCalledMethod, /*catch*/ false, thr),
SuspendEvents::clearSuspendExceptionEvent);
final Method exceptionThrowFarCalledMethod =
ExceptionThrowFarTestObject.class.getDeclaredMethod("calledFunction");
System.out.println("Test stopped during Exception event of calledFunction " + "(catch in parent of calling function)");
runTestOn(new ExceptionThrowFarTestObject(false),
(thr) -> setupSuspendExceptionEvent(exceptionThrowFarCalledMethod, /*catch*/ false, thr),
SuspendEvents::clearSuspendExceptionEvent);
System.out.println("Test stopped during Exception event of calledFunction " + "(catch in called function)");
runTestOn(new ExceptionThrowFarTestObject(true),
(thr) -> setupSuspendExceptionEvent(exceptionThrowFarCalledMethod, /*catch*/ false, thr),
SuspendEvents::clearSuspendExceptionEvent);
// These tests are disabled for either the RI (b/116003018) or for jvmti-stress. For the // later it is due to the additional agent causing classes to be loaded earlier as it forces // deeper verification during class redefinition, causing failures. // NB the agent is prevented from popping frames in either of these events in ART. See // b/117615146 for more information about this restriction. if (canRunClassLoadTests && CanRunClassLoadingTests()) { // This test doesn't work on RI since the RI disallows use of PopFrame during a ClassLoad // event. See b/116003018 for more information.
System.out.println("Test stopped during a ClassLoad event.");
runTestOn(new ClassLoadObject(),
(thr) -> setupSuspendClassEvent(EVENT_TYPE_CLASS_LOAD, ClassLoadObject.CLASS_NAMES, thr),
SuspendEvents::clearSuspendClassEvent);
// The RI handles a PopFrame during a ClassPrepare event incorrectly. See b/116003018 for // more information.
System.out.println("Test stopped during a ClassPrepare event.");
runTestOn(new ClassLoadObject(),
(thr) -> setupSuspendClassEvent(EVENT_TYPE_CLASS_PREPARE,
ClassLoadObject.CLASS_NAMES,
thr),
SuspendEvents::clearSuspendClassEvent);
}
System.out.println("Test stopped during random Suspend."); final SuspendSuddenlyObject sso = new SuspendSuddenlyObject();
runTestOn(
sso, new TestSuspender() { publicvoid setup(Thread thr) { } publicvoid waitForSuspend(Thread thr) { while (!sso.is_spinning) {}
Suspension.suspend(thr);
} publicvoid cleanup(Thread thr) {
sso.stop_spinning = true;
}
});
System.out.println("Test stopped during a native method fails");
runTestOn(new NativeCalledObject(),
SuspendEvents::setupWaitForNativeCall,
SuspendEvents::clearWaitForNativeCall);
System.out.println("Test stopped in a method called by native fails"); final Method nativeCallerMethod = NativeCallerObject.class.getDeclaredMethod("calledFunction");
runTestOn(new NativeCallerObject(),
(thr) -> setupSuspendMethodEvent(nativeCallerMethod, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
final Object lock2 = new Object(); synchronized (lock2) {}
System.out.println("Test stopped with monitor in enclosing frame.");
runTestOn(new StandardTestObject() {
@Override publicvoid run() { synchronized (lock2) { super.run();
}
}
},
(thr) -> setupSuspendBreakpointFor(calledFunction, loc, thr),
SuspendEvents::clearSuspendBreakpointFor); synchronized (lock2) {}
}
// Volatile is to prevent any future optimizations that could invalidate this test by doing // constant propagation and eliminating the failing paths before the verifier is able to load the // class. staticvolatileboolean ranClassLoadTest = false; staticboolean classesPreverified = false; privatestaticfinalclass RCLT0 { publicvoid foo() {} } privatestaticfinalclass RCLT1 { publicvoid foo() {} } // If classes are not preverified for some reason (interp-ac, no-image, etc) the verifier will // actually load classes as it runs. This means that we cannot use the class-load tests as they // are written. TODO Support this. publicboolean CanRunClassLoadingTests() { if (ranClassLoadTest) { return classesPreverified;
} if (!ranClassLoadTest) { // Only this will ever be executed. new RCLT0().foo();
} else { // This will never be executed. If classes are not preverified the verifier will load RCLT1 // when the enclosing method is run. This behavior makes the class-load/prepare test cases // impossible to successfully run (they will deadlock). new RCLT1().foo();
System.out.println("FAILURE: UNREACHABLE Location!");
}
classesPreverified = !isClassLoaded("Lart/Test1953$RCLT1;");
ranClassLoadTest = true; return classesPreverified;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.