我正在使用扩展中的 VSCode 调试 API。我的目标是在调试会话期间从 gdb/lldb 调试器读取 C++ 程序的 CPU 寄存器。我对当前调试器不提供的其他事情(读取内存、反汇编等)也有类似的请求
我的扩展中有以下内容...如果需要,我可以提供完整的测试用例。是的,我知道我这里有一个错误,在第一次等待之后,会话可能不再处于活动状态,并且我没有显示完整的错误检查。
static async getRegisters() {
const session = vscode.debug.activeDebugSession;
if (session && text) { // Make sure we still have a session
// The following gets me the right result
const sTrace = await session.customRequest('stackTrace', { threadId: 1 });
const frameId = sTrace.stackFrames[0].id;
// The following does execute but the results are printed to debug console
// rather than returning the result
// I tried many variations of arguments and …Run Code Online (Sandbox Code Playgroud)