public Promise<Void> continueToLocation(SourceLocation location) { return continueToLocation(location.getFileName(), location.getLine()); }
public Collection<GeneratedLocation> getGeneratedLocations(SourceLocation sourceLocation) { return getGeneratedLocations(sourceLocation.getFileName(), sourceLocation.getLine()); }
public DebuggerCallSite[] getCallSites(SourceLocation location) { Integer fileIndex = fileNameMap.get(location.getFileName()); if (fileIndex == null) { return new DebuggerCallSite[0]; } RecordArray mapping = lineCallSites[fileIndex]; if (location.getLine() >= mapping.size()) { return new DebuggerCallSite[0]; } int[] callSiteIds = mapping.get(location.getLine()).getArray(0); DebuggerCallSite[] callSites = new DebuggerCallSite[callSiteIds.length]; for (int i = 0; i < callSiteIds.length; ++i) { callSites[i] = getCallSite(callSiteIds[i]); } return callSites; }
fileName = location.getFileName(); fileName = fileName.substring(fileName.lastIndexOf('/') + 1); lineNumber = location.getLine(); } else { fileName = "test.js";
public SourceLocation[] getFollowingLines(SourceLocation location) { Integer fileIndex = fileNameMap.get(location.getFileName()); if (fileIndex == null) { return null; } RecordArray cfg = controlFlowGraphs[fileIndex]; if (cfg == null) { return null; } if (location.getLine() >= cfg.size()) { return null; } int type = cfg.get(location.getLine()).get(0); if (type == 0) { return null; } int[] data = cfg.get(location.getLine()).getArray(0); int length = data.length / 2; int size = length; if (type == 2) { ++size; } SourceLocation[] result = new SourceLocation[size]; for (int i = 0; i < length; ++i) { result[i] = new SourceLocation(fileNames[data[i * 2]], data[i * 2 + 1]); } return result; }
@Override public void addSuccessors(SourceLocation location, SourceLocation[] successors) { int fileIndex = files.index(location.getFileName()); while (cfgs.size() <= fileIndex) { cfgs.add(new RecordArrayBuilder(1, 1)); } RecordArrayBuilder cfg = cfgs.get(fileIndex); while (cfg.size() <= location.getLine()) { cfg.add(); } RecordArrayBuilder.Record record = cfg.get(location.getLine()); if (record.get(0) == 0) { record.set(0, 1); } RecordArrayBuilder.SubArray array = record.getArray(0); for (SourceLocation succ : successors) { if (succ == null) { record.set(0, 2); } else { array.add(files.index(succ.getFileName())); array.add(succ.getLine()); } } }
private static Frame deobfuscateFrame(DebugInformation debugInformation, String classesFileName, String fileName, int lineNumber, int columnNumber) { if (!fileName.equals(classesFileName)) { return null; } MethodReference method = debugInformation.getMethodAt(lineNumber - 1, columnNumber - 1); if (method == null) { return null; } SourceLocation location = debugInformation.getSourceLocation(lineNumber - 1, columnNumber - 1); String decodedFileName = location != null ? location.getFileName() : null; if (decodedFileName != null) { decodedFileName = decodedFileName.substring(decodedFileName.lastIndexOf('/') + 1); } Frame frame = createEmptyFrame(); frame.setClassName(method.getClassName()); frame.setMethodName(method.getName()); frame.setFileName(decodedFileName); if (location != null) { frame.setLineNumber(location.getLine()); } return frame; }
public CallFrame[] getCallStack() { if (!isSuspended()) { return null; } if (callStack == null) { // TODO: with inlining enabled we can have several JVM methods compiled into one JavaScript function // so we must consider this case. List<CallFrame> frames = new ArrayList<>(); boolean wasEmpty = false; for (JavaScriptCallFrame jsFrame : javaScriptDebugger.getCallStack()) { DebugInformation debugInformation = debugInformationMap.get(jsFrame.getLocation().getScript()); SourceLocation loc; if (debugInformation != null) { loc = debugInformation.getSourceLocation(jsFrame.getLocation().getLine(), jsFrame.getLocation().getColumn()); } else { loc = null; } boolean empty = loc == null || (loc.getFileName() == null && loc.getLine() < 0); MethodReference method = !empty ? debugInformation.getMethodAt(jsFrame.getLocation().getLine(), jsFrame.getLocation().getColumn()) : null; if (!empty || !wasEmpty) { frames.add(new CallFrame(this, jsFrame, loc, method, debugInformation)); } wasEmpty = empty; } callStack = frames.toArray(new CallFrame[0]); } return callStack.clone(); }
|| recentFrame.getLocation().getLine() < 0) { return jsStep(enterMethod); DebugInformation debugInfo = debugInformationMap.get(script); if (frame.getLocation() != null && frame.getLocation().getFileName() != null && frame.getLocation().getLine() >= 0 && debugInfo != null) { exits = addFollowing(debugInfo, frame.getLocation(), script, new HashSet<>(), successors); if (enterMethod) {
@Around(" ..... ") public void test(ProceedingJoinPoint pjp) throws Throwable { SourceLocation sl = pjp.getSourceLocation(); System.out.println(sl.getFileName()); System.out.println(sl.getLine()); System.out.println(sl.getWithinType()); // allow through pjp.proceed(); }
public void continueToLocation(SourceLocation location) { continueToLocation(location.getFileName(), location.getLine()); }
public Collection<GeneratedLocation> getGeneratedLocations(SourceLocation sourceLocation) { return getGeneratedLocations(sourceLocation.getFileName(), sourceLocation.getLine()); }
public DebuggerCallSite[] getCallSites(SourceLocation location) { Integer fileIndex = fileNameMap.get(location.getFileName()); if (fileIndex == null) { return new DebuggerCallSite[0]; } RecordArray mapping = lineCallSites[fileIndex]; if (location.getLine() >= mapping.size()) { return new DebuggerCallSite[0]; } int[] callSiteIds = mapping.get(location.getLine()).getArray(0); DebuggerCallSite[] callSites = new DebuggerCallSite[callSiteIds.length]; for (int i = 0; i < callSiteIds.length; ++i) { callSites[i] = getCallSite(callSiteIds[i]); } return callSites; }
public SourceLocation[] getFollowingLines(SourceLocation location) { Integer fileIndex = fileNameMap.get(location.getFileName()); if (fileIndex == null) { return null; } RecordArray cfg = controlFlowGraphs[fileIndex]; if (cfg == null) { return null; } if (location.getLine() >= cfg.size()) { return null; } int type = cfg.get(location.getLine()).get(0); if (type == 0) { return null; } int[] data = cfg.get(location.getLine()).getArray(0); int length = data.length / 2; int size = length; if (type == 2) { ++size; } SourceLocation[] result = new SourceLocation[size]; for (int i = 0; i < length; ++i) { result[i] = new SourceLocation(fileNames[data[i * 2]], data[i * 2 + 1]); } return result; }
@Override public void addSuccessors(SourceLocation location, SourceLocation[] successors) { int fileIndex = files.index(location.getFileName()); while (cfgs.size() <= fileIndex) { cfgs.add(new RecordArrayBuilder(1, 1)); } RecordArrayBuilder cfg = cfgs.get(fileIndex); while (cfg.size() <= location.getLine()) { cfg.add(); } RecordArrayBuilder.Record record = cfg.get(location.getLine()); if (record.get(0) == 0) { record.set(0, 1); } RecordArrayBuilder.SubArray array = record.getArray(0); for (SourceLocation succ : successors) { if (succ == null) { record.set(0, 2); } else { array.add(files.index(succ.getFileName())); array.add(succ.getLine()); } } }
|| recentFrame.getLocation().getLine() < 0) { jsStep(enterMethod); return; DebugInformation debugInfo = debugInformationMap.get(script); if (frame.getLocation() != null && frame.getLocation().getFileName() != null && frame.getLocation().getLine() >= 0 && debugInfo != null) { exits = addFollowing(debugInfo, frame.getLocation(), script, new HashSet<>(), successors); if (enterMethod) {
loc = null; boolean empty = loc == null || (loc.getFileName() == null && loc.getLine() < 0); MethodReference method = !empty ? debugInformation.getMethodAt(jsFrame.getLocation().getLine(), jsFrame.getLocation().getColumn()) : null;