本文整理汇总了TypeScript中vscode-debugadapter-testsupport.DebugClient.stackTraceRequest方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DebugClient.stackTraceRequest方法的具体用法?TypeScript DebugClient.stackTraceRequest怎么用?TypeScript DebugClient.stackTraceRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode-debugadapter-testsupport.DebugClient
的用法示例。
在下文中一共展示了DebugClient.stackTraceRequest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should add a condition to an already set breakpoint', async function() {
await util.receivePageLoadedEvent(dc);
let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, sourcePath, [ { line: 24 } ]);
let stoppedEvent = await util.runCommandAndReceiveStoppedEvent(dc,
() => util.evaluate(dc, 'factorial(5)')
);
let threadId = stoppedEvent.body.threadId!;
let stackTrace = await dc.stackTraceRequest({ threadId });
let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
let variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
let variables = variablesResponse.body.variables;
assert.equal(util.findVariable(variables, 'n').value, '5');
await util.setBreakpoints(dc, sourcePath, [ { line: 24, condition: 'n === 2' } ]);
await dc.continueRequest({ threadId });
await util.runCommandAndReceiveStoppedEvent(dc,
() => util.evaluate(dc, 'factorial(5)')
);
stackTrace = await dc.stackTraceRequest({ threadId });
scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
variables = variablesResponse.body.variables;
assert.equal(util.findVariable(variables, 'n').value, '2');
});
示例2: assert
dc.waitForEvent('stopped').then(async (response1) => {
let response2 = await dc.stackTraceRequest({ threadId: response1.body.threadId, startFrame: 20, levels: 10 });
assert(response2.body.stackFrames.length == 10)
let response3 = await dc.scopesRequest({ frameId: response2.body.stackFrames[0].id });
let response4 = await dc.variablesRequest({ variablesReference: response3.body.scopes[0].variablesReference });
assert(response4.body.variables[0].name == 'levelsToGo');
assert(response4.body.variables[0].value == '20');
}),
示例3: it
it('should not hit a breakpoint after it has been removed', async function() {
let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, sourcePath, [ 8, 10 ]);
util.evaluateCloaked(dc, 'vars()');
let stoppedEvent = await util.receiveStoppedEvent(dc);
let threadId = stoppedEvent.body.threadId!;
let stackTrace = await dc.stackTraceRequest({ threadId });
assert.equal(stackTrace.body.stackFrames[0].line, 8);
await util.setBreakpoints(dc, sourcePath, [ 12 ]);
await util.runCommandAndReceiveStoppedEvent(dc, () => dc.continueRequest({ threadId }));
stackTrace = await dc.stackTraceRequest({ threadId });
assert.equal(stackTrace.body.stackFrames[0].line, 12);
});
示例4: it
it('should step out', async function() {
let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, sourcePath, [ 3 ]);
util.evaluate(dc, 'vars()');
let stoppedEvent = await util.receiveStoppedEvent(dc);
let threadId = stoppedEvent.body.threadId!;
let stackTrace = await dc.stackTraceRequest({ threadId });
assert.equal(stackTrace.body.stackFrames[0].source!.path, sourcePath);
assert.equal(stackTrace.body.stackFrames[0].line, 3);
dc.stepOutRequest({ threadId });
await util.receiveStoppedEvent(dc);
stackTrace = await dc.stackTraceRequest({ threadId });
assert.equal(stackTrace.body.stackFrames[0].source!.path, sourcePath);
assert.equal(stackTrace.body.stackFrames[0].line, 21);
});
示例5: it
it('should skip over breakpoints when evaluating watches while paused', async function() {
let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, sourcePath, [ 8, 25 ]);
util.evaluate(dc, 'vars()');
let stoppedEvent = await util.receiveStoppedEvent(dc);
let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
dc.evaluateRequest({ expression: 'factorial(3)', context: 'watch',
frameId: stackTrace.body.stackFrames[0].id });
await util.assertPromiseTimeout(util.receiveStoppedEvent(dc), 200);
});
示例6: startAndGetProperties
async function startAndGetProperties(dc: DebugClient, bpLine: number, trigger: string): Promise<DebugProtocol.Variable[]> {
await util.setBreakpoints(dc, SOURCE_PATH, [ bpLine ]);
util.evaluate(dc, trigger);
let stoppedEvent = await util.receiveStoppedEvent(dc);
let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
let variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
let variable = util.findVariable(variablesResponse.body.variables, 'x');
let propertiesResponse = await dc.variablesRequest({ variablesReference: variable.variablesReference });
return propertiesResponse.body.variables;
}
示例7: it
it('should debug a WebWorker', async function() {
let mainSourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, mainSourcePath, [ 55 ]);
let workerSourcePath = path.join(TESTDATA_PATH, 'web/worker.js');
let workerBreakpointsResponse = await util.setBreakpoints(dc, workerSourcePath, [ 2 ], false);
let workerBreakpoint = workerBreakpointsResponse.body.breakpoints[0];
assert.equal(workerBreakpoint.verified, false);
util.evaluateDelayed(dc, 'startWorker()', 0);
let breakpointEvent = await util.receiveBreakpointEvent(dc);
assert.equal(breakpointEvent.body.breakpoint.id, workerBreakpoint.id);
assert.equal(breakpointEvent.body.breakpoint.verified, true);
assert.equal(breakpointEvent.body.breakpoint.line, 2);
util.evaluateDelayed(dc, 'callWorker()', 0);
let stoppedEvent = await util.receiveStoppedEvent(dc);
let workerThreadId = stoppedEvent.body.threadId!;
let stackTrace = await dc.stackTraceRequest({ threadId: workerThreadId });
assert.equal(stackTrace.body.stackFrames[0].source!.path, workerSourcePath);
dc.continueRequest({ threadId: workerThreadId });
stoppedEvent = await util.receiveStoppedEvent(dc);
let mainThreadId = stoppedEvent.body.threadId!;
stackTrace = await dc.stackTraceRequest({ threadId: mainThreadId });
let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
let variables = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
assert.notEqual(mainThreadId, workerThreadId);
assert.equal(stackTrace.body.stackFrames[0].source!.path, mainSourcePath);
assert.equal(util.findVariable(variables.body.variables, 'received').value, '"bar"');
});
示例8: it
it('should inspect variables in different stackframes', async function() {
let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
await util.setBreakpoints(dc, sourcePath, [ 25 ]);
util.evaluateDelayed(dc, 'factorial(4)', 0);
let stoppedEvent = await util.receiveStoppedEvent(dc);
let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
for (let i = 0; i < 4; i++) {
let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[i].id });
let variables = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
assert.equal(util.findVariable(variables.body.variables, 'n').value, i + 1);
}
});