Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const uri = location.script.uri;
const shortName = this.convertVMUriToUserName(uri);
let sourcePath: string | undefined = this.convertVMUriToSourcePath(uri);
let canShowSource = fs.existsSync(sourcePath);
// Download the source if from a "dart:" uri.
let sourceReference: number;
if (uri.startsWith("dart:")) {
sourcePath = undefined;
sourceReference = thread.storeData(location.script);
canShowSource = true;
}
const stackFrame: DebugProtocol.StackFrame = new StackFrame(
frameId,
frameName,
canShowSource ? new Source(shortName, sourcePath, sourceReference, null, location.script) : undefined,
0, 0,
);
// If we wouldn't debug this source, then deemphasize in the stack.
if (stackFrame.source) {
if (!this.isValidToDebug(uri) || (this.isSdkLibrary(uri) && !this.debugSdkLibraries)) {
stackFrame.source.origin = "from the Dart SDK";
stackFrame.source.presentationHint = "deemphasize";
} else if (this.isExternalLibrary(uri) && !this.debugExternalLibraries) {
stackFrame.source.origin = uri.startsWith("package:flutter/") ? "from the Flutter framework" : "from Pub packages";
stackFrame.source.presentationHint = "deemphasize";
}
}
stackFrames.push(stackFrame);
let ret: StackFrame[] = stack.map(element => {
let file = element.file;
if (file) {
if (process.platform === "win32") {
if (file.startsWith("\\cygdrive\\") || file.startsWith("/cygdrive/")) {
file = file[10] + ":" + file.substr(11); // replaces /cygdrive/c/foo/bar.txt with c:/foo/bar.txt
}
}
return new StackFrame(element.level, element.function + "@" + element.address, new Source(element.fileName, file), element.line, 0);
}
else
return new StackFrame(element.level, element.function + "@" + element.address, null, element.line, 0);
});
response.body = {
}
const uri = location.script.uri;
let sourcePath = this.convertVMUriToSourcePath(uri);
let canShowSource = sourcePath && fs.existsSync(sourcePath);
// Download the source if from a "dart:" uri.
let sourceReference: number | undefined;
if (uri.startsWith("dart:")) {
sourcePath = undefined;
sourceReference = thread.storeData(location.script);
canShowSource = true;
}
const shortName = this.formatUriForShortDisplay(uri);
const stackFrame: DebugProtocol.StackFrame = new StackFrame(
frameId,
frameName,
canShowSource ? new Source(shortName, sourcePath, sourceReference, undefined, location.script) : undefined,
0, 0,
);
// The top frame is only allowed to be deemphasized when it's an exception (so the editor walks
// up the stack to user code). If the reson for stopping was a breakpoint, step, etc., then we
// should always leave the frame focusable.
const isTopFrame = stackFrames.length === 0;
const isStoppedAtException = thread.exceptionReference !== 0;
const allowDeemphasizingFrame = !isTopFrame || isStoppedAtException;
// If we wouldn't debug this source, then deemphasize in the stack.
if (stackFrame.source && allowDeemphasizingFrame) {
if (!this.isValidToDebug(uri) || (this.isSdkLibrary(uri) && !this.debugSdkLibraries)) {
stackFrame.source.origin = "from the Dart SDK";
stackFrame.source.presentationHint = "deemphasize";
stackFrames.push(stackFrame);
return;
}
const frameName =
frame && frame.code && frame.code.name
? (
frame.code.name.startsWith(unoptimizedPrefix)
? frame.code.name.substring(unoptimizedPrefix.length)
: frame.code.name
)
: "";
const location = frame.location;
if (!location) {
const stackFrame: DebugProtocol.StackFrame = new StackFrame(frameId, frameName);
stackFrame.presentationHint = "subtle";
stackFrames.push(stackFrame);
return;
}
const uri = location.script.uri;
let sourcePath = this.convertVMUriToSourcePath(uri);
let canShowSource = sourcePath && fs.existsSync(sourcePath);
// Download the source if from a "dart:" uri.
let sourceReference: number | undefined;
if (uri.startsWith("dart:")) {
sourcePath = undefined;
sourceReference = thread.storeData(location.script);
canShowSource = true;
}
fname = `${symbolInfo.name}.cdasm`;
url = `disassembly:///${symbolInfo.name}.cdasm`;
}
ret.push(new StackFrame(stackId, `${element.function}@${element.address}`, new Source(fname, url), line, 0));
}
else {
ret.push(new StackFrame(stackId, element.function + '@' + element.address, null, element.line, 0));
}
}
else {
ret.push(new StackFrame(stackId, element.function + '@' + element.address, new Source(element.fileName, file), element.line, 0));
}
}
catch (e) {
ret.push(new StackFrame(stackId, element.function + '@' + element.address, null, element.line, 0));
}
}
response.body = {
stackFrames: ret
};
this.sendResponse(response);
}
catch (err) {
this.sendErrorResponse(response, 12, `Failed to get Stack Trace: ${err.toString()}`);
}
}
public handle(logContext: LogContext): boolean {
const logFileName = logContext.getLogFileName();
logContext
.getFrames()
.push(
new StackFrame(
0,
'',
new Source(logFileName, logContext.getLogFilePath()),
logContext.getLogLinePosition() + 1
)
);
return true;
}
}
const stackFrames = callStack.reverse().map((c) => {
return new StackFrame(0, c.method, this.createSource(c.file),
this.convertDebuggerLineToClient(c.line), c.column);
});
response.body = {
if(path.isAbsolute(infos[0]) && fs.existsSync(infos[0]))
{
completePath = getRealPath(infos[0]);
found=true;
} else
for(i=0;i0)
{
var args = this.stackArgs.shift();
var resp = this.stack.shift();
args.startFrame = args.startFrame || 0;
args.levels = args.levels || frames.length;
args.levels += args.startFrame;
resp.body = {
stackFrames: frames.slice(args.startFrame, args.levels)
};
this.sendResponse(resp);
return validatePath(this.convertDebuggerPathToClient(frame.FileName)).then(fileName => {
const frameId = this._pythonStackFrames.create(frame);
if (fileName.length === 0) {
return new StackFrame(frameId, frame.FunctionName);
}
else {
return new StackFrame(frameId, frame.FunctionName,
new Source(path.basename(frame.FileName), fileName),
this.convertDebuggerLineToClient(frame.LineNo - 1),
1);
}
});
});
} else {
newAddress = cop1Addr;
lineNumber = lineInCop1;
}
} else if (cop2Addr && (lineInCop2 >= 0)) {
newAddress = cop2Addr;
lineNumber = lineInCop2;
}
}
dAsmFile.setStackFrameIndex(stackFrameIndex).setAddressExpression(`\$${newAddress.toString(16)}`).setLength(length);
}
url = `disassembly:///${dAsmFile}`;
if (lineNumber >= 0) {
resolve(new StackFrame(stackFrameIndex, stackFrameLabel, new Source(dAsmFile.toString(), url), lineNumber, 1));
} else {
resolve(new StackFrame(stackFrameIndex, stackFrameLabel));
}
});
}