如何获取VS Code调试数据,如断点,步骤,行代码 [英] How to get VS Code debug data like breakpoints, steps, line code

查看:183
本文介绍了如何获取VS Code调试数据,如断点,步骤,行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个学术软件可视化项目,该项目旨在捕获调试会话并以图形方式显示.为此,我试图创建一个Visual Studio代码扩展,在这里我可以与当前的语言调试器交换数据,例如添加的断点,stepsinto,stepover,调试会话开始,调试文件,上下文变量,行代码.调试.也就是说,在VS Code窗口中显示的数据相同:VARIABLES,WATCH,CALL STACK,LOADED SCRIPTS和BREAKPOINTS.

I'm working on an academic software visualization project that aims to capture debug sessions and display graphically. For this, I am trying to create a Visual Studio Code Extension where I can get the data exchanged with the current language debugger, such as added breakpoints, stepsinto, stepsover, debug session start, debug file, context variables, line code debugged. That is, the same data that is displayed in the VS Code windows: VARIABLES, WATCH, CALL STACK, LOADED SCRIPTS and BREAKPOINTS.

我尝试创建一个扩展,该扩展使用调试适配器(DAP-调试适配器协议)添加了新的调试器提供程序.但是,这将取消当前的提供程序,并且不允许调试. https://code.visualstudio.com/api/extension-guides/debugger-扩展名

I tried to create an extension that adds a new Debugger Provider, using Debug Adapter (DAP - Debug Adapter Protocol). However this cancels the current provider and does not allow debugging. https://code.visualstudio.com/api/extension-guides/debugger-extension

我还尝试使用 VS Code API 事件.通过这些事件,我设法控制了会话的开始和一些断点数据,但是这些数据不完整. https://code.visualstudio.com/api/references/vscode-api#调试

I also tried using the VS Code API events. With these events I managed to control the start of the session and some breakpoint data, however incomplete. https://code.visualstudio.com/api/references/vscode-api#debug

是否有人知道如何在VS Code范围( VS Code通用调试器UI )中捕获此调试数据,即不管使用哪种语言?VS Code的GitHub是否对此有任何未解决的问题?

Would anyone know how to capture this debugging data in the VS Code scope (VS Code Generic Debugger UI), that is, regardless of the language used? Is there any open issue for this in VS Code's GitHub?

推荐答案

此解决方案称为 DebugAdapterTracker .

vscode.debug.registerDebugAdapterTrackerFactory('*', {
  createDebugAdapterTracker(session: DebugSession) {
    return {
      onWillReceiveMessage: m => console.log(`> ${JSON.stringify(m, undefined, 2)}`),
      onDidSendMessage: m => console.log(`< ${JSON.stringify(m, undefined, 2)}`)
    };
  }
});

https://code.visualstudio.com/updates/v1_30#_extension-authoring

寻找最终调试适配器跟踪器API".它最初是为Live Share调试创建的.

Look for "Finalized Debug Adapter Tracker API". It was originally created for Live Share debugging.

这篇关于如何获取VS Code调试数据,如断点,步骤,行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆