actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
437 stars 95 forks source link

attach模式的tcp模式所监听的端口,是DAP的吗? #115

Closed wendal closed 3 years ago

wendal commented 3 years ago

环境: vscode 1.52.1 windows 7 sp1 x64

首先, 配置是这样的:

        {
            "type" : "lua",
            "request" : "attach",
            "name": "debugFromComPort",
            "address": "127.0.0.1:4278",
            "client": false,
            "sourceCoding" : "utf8",
            "stopOnEntry" : false,
        }

然后, 执行启动后, 可以看到vscode在等待着什么, 通过netstat工具可以看到监听了4278端口.

接着, 尝试用tcp client去连接 4278 端口, 尝试用 DAP(Debug Adapter Protocol) 去通信

--> 尝试发 initital request, 失败. --> 尝试发 event output, 可以在DEBUG Console看到输出.

至此有几个疑问:

  1. 4278端口的通信协议是DAP吗?
  2. 如果是DAP, 该端口连接成功后, 没有主动下发数据, 需要客户端发送什么内容呢? 或者说,通信时序能描述一下吗? 根据我对DAP的理解, 首先就是发 initital request, 但返回的是失败

应用场景是给嵌入式设备的lua vm进行debug操作, 对外只有串口, 所以打算用串口转socket的方式, 把两端桥接起来.

期待与你进一步交流

actboy168 commented 3 years ago

我认为你需要做的是实现一个代理,而不是研究DAP协议

wendal commented 3 years ago

做一个代理? 可否再明确点?

wendal commented 3 years ago

设备 <--> 串口 <--> 代理?? <--> vscode

这样吗?

wendal commented 3 years ago

我原本的思路是

设备 <-(DAP)-> 串口 <--> Sockect <-(DAP)-> lua-debug插件的4278端口 
wendal commented 3 years ago

我懂了,直接写vscode debug adatper的意思,谢谢了

actboy168 commented 3 years ago

lua-debug<->代理<->串口<->代理<->vscode