}
Collection<Script> scripts = loadScripts(vm);
// Finding script1.js script.
Script scriptOne;
lookForScript: {
for (Script script : scripts) {
String name = script.getName();
if (name != null && name.endsWith(SCRIPT_ONE_NAME)) {
scriptOne = script;
break lookForScript;
}
}
throw new SmokeException("Failed to find script " + SCRIPT_ONE_NAME);
}
// Getting a number of the line with the marker.
int breakLine = findSourceMark(scriptOne, BREAKPOINT_MARK);
if (breakLine == -1) {
throw new SmokeException("Failed to find mark in script");
}
// Setting a breakpoint.
CallbackSemaphore callbackSemaphore = new CallbackSemaphore();
Breakpoint.Target breakpointTarget = new Breakpoint.Target.ScriptName(scriptOne.getName());
RelayOk relayOk = vm.setBreakpoint(breakpointTarget, breakLine, 0, true, null,
null, callbackSemaphore);
callbackSemaphore.acquireDefault(relayOk);
// First time just suspend on breakpoint and go on.