use of com.oracle.truffle.tools.chromeinspector.server.CommandProcessException in project graal by oracle.
the class BreakpointsHandler method createBreakpoint.
Params createBreakpoint(Location location, String condition) throws CommandProcessException {
Script script = slh.getScript(location.getScriptId());
if (script == null) {
throw new CommandProcessException("No script with id '" + location.getScriptId() + "'");
}
Breakpoint bp = createBuilder(script.getSource(), location.getLine(), location.getColumn()).resolveListener(resolvedHandler).build();
if (condition != null && !condition.isEmpty()) {
bp.setCondition(condition);
}
bp = ds.install(bp);
JSONArray locations = new JSONArray();
long id;
synchronized (bpIDs) {
id = ++lastID;
bpIDs.put(bp, id);
SourceSection section = resolvedBreakpoints.remove(bp);
if (section != null) {
Location resolvedLocation = new Location(location.getScriptId(), section.getStartLine(), section.getStartColumn());
locations.put(resolvedLocation.toJSON());
}
}
JSONObject json = new JSONObject();
json.put("breakpointId", Long.toString(id));
locations.put(location.toJSON());
json.put("locations", locations);
return new Params(json);
}
Aggregations