小编blu*_*fox的帖子

如何使用 DebugSession.customRequest 运行任意 gdb 命令并获取结果

我正在使用扩展中的 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)

typescript visual-studio-code

3
推荐指数
1
解决办法
668
查看次数

标签 统计

typescript ×1

visual-studio-code ×1