xmake-io / xmake-vscode

🍩 A XMake integration in Visual Studio Code
https://xmake.io
Apache License 2.0
228 stars 55 forks source link

改变 launch.json 中的 cwd 路径后,调试时找不到 C++ 源码 #203

Open vrecluse opened 1 year ago

vrecluse commented 1 year ago

Xmake 版本

xmake v2.7.9+20230523

操作系统版本和架构

Linux 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

描述问题

launch.json 配置如下

        {
            "name": "XMake Debug",
            "type": "xmake",
            "request": "launch",
            "target": "panda",
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}/build"
        }

调试时断点找不到源码,把 cwd 设置为 workspaceFolder 才能找到 image

但希望能在不同的工作路径下调试程序

期待的结果

修改cwd后,调试能够找到源码

工程配置

No response

附加信息和错误日志

No response

waruqi commented 1 year ago

set_rundir 可以自己 xmake.lua 直接配置

vrecluse commented 1 year ago

set_rundir 可以自己 xmake.lua 直接配置

set_rundir 后,如果不把 launch.js 中 cwd 配置删除,还是用的 cwd 路径 删了之后,源码用的似乎是绝对路径导致找不到源码(实际应该在 ./src/panda 而不是 /src/panda) image

        {
            "name": "XMake Debug",
            "type": "xmake",
            "request": "launch",
            "target": "panda",
            "stopAtEntry": false
        }
vrecluse commented 1 year ago

image F5 运行会一直报这个错,也重新运行 xmake 重新编译过