Search in sources :

Example 6 with Script

use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.

the class BreakpointsHandler method createOneShotBreakpoint.

void createOneShotBreakpoint(Location location) 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()).oneShot().build();
    ds.install(bp);
}
Also used : CommandProcessException(com.oracle.truffle.tools.chromeinspector.server.CommandProcessException) Script(com.oracle.truffle.tools.chromeinspector.types.Script) Breakpoint(com.oracle.truffle.api.debug.Breakpoint)

Example 7 with Script

use of com.oracle.truffle.tools.chromeinspector.types.Script 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);
}
Also used : CommandProcessException(com.oracle.truffle.tools.chromeinspector.server.CommandProcessException) Script(com.oracle.truffle.tools.chromeinspector.types.Script) Breakpoint(com.oracle.truffle.api.debug.Breakpoint) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Params(com.oracle.truffle.tools.chromeinspector.commands.Params) SourceSection(com.oracle.truffle.api.source.SourceSection) Location(com.oracle.truffle.tools.chromeinspector.types.Location)

Example 8 with Script

use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.

the class ScriptsHandler method assureLoaded.

int assureLoaded(Source source) {
    Script scr;
    URI uri = source.getURI();
    int id;
    LoadScriptListener[] listenersToNotify;
    synchronized (sourceIDs) {
        Integer eid = sourceIDs.get(source);
        if (eid != null) {
            return eid;
        }
        id = scripts.size();
        String sourceUrl = getNiceStringFromURI(uri);
        scr = new Script(id, sourceUrl, source);
        sourceIDs.put(source, id);
        scripts.add(scr);
        listenersToNotify = listeners.toArray(new LoadScriptListener[listeners.size()]);
    }
    for (LoadScriptListener l : listenersToNotify) {
        l.loadedScript(scr);
    }
    return id;
}
Also used : Script(com.oracle.truffle.tools.chromeinspector.types.Script) URI(java.net.URI)

Example 9 with Script

use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.

the class ScriptsHandler method addLoadScriptListener.

void addLoadScriptListener(LoadScriptListener listener) {
    List<Script> scriptsToNotify;
    synchronized (sourceIDs) {
        scriptsToNotify = new ArrayList<>(scripts);
        listeners.add(listener);
    }
    for (Script scr : scriptsToNotify) {
        listener.loadedScript(scr);
    }
}
Also used : Script(com.oracle.truffle.tools.chromeinspector.types.Script)

Aggregations

Script (com.oracle.truffle.tools.chromeinspector.types.Script)9 Params (com.oracle.truffle.tools.chromeinspector.commands.Params)5 CommandProcessException (com.oracle.truffle.tools.chromeinspector.server.CommandProcessException)5 JSONObject (org.json.JSONObject)5 Breakpoint (com.oracle.truffle.api.debug.Breakpoint)4 Source (com.oracle.truffle.api.source.Source)4 SourceSection (com.oracle.truffle.api.source.SourceSection)4 JSONArray (org.json.JSONArray)4 ArrayList (java.util.ArrayList)3 Location (com.oracle.truffle.tools.chromeinspector.types.Location)2 ScriptTypeProfile (com.oracle.truffle.tools.chromeinspector.types.ScriptTypeProfile)2 TypeObject (com.oracle.truffle.tools.chromeinspector.types.TypeObject)2 TypeProfileEntry (com.oracle.truffle.tools.chromeinspector.types.TypeProfileEntry)2 Collection (java.util.Collection)2 InstrumentInfo (com.oracle.truffle.api.InstrumentInfo)1 TruffleException (com.oracle.truffle.api.TruffleException)1 DebugScope (com.oracle.truffle.api.debug.DebugScope)1 DebugStackFrame (com.oracle.truffle.api.debug.DebugStackFrame)1 SourceSectionFilter (com.oracle.truffle.api.instrumentation.SourceSectionFilter)1 StandardTags (com.oracle.truffle.api.instrumentation.StandardTags)1