Open poemdistance opened 9 months ago
断点你下了么,既然断下了,后面就跟 xmake 插件没啥关系了,完全由 vscode cpptools/codelldb 调试接管了,你得到他们那边反馈
装了的,新建launch.json,用以下配置,然后用左侧栏的调试按钮可以正常调试:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/build/windows/x64/debug/hello.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
]
}
请教下点击xmake的调试按钮后,发生了什么,怎么转交调试过程给vscode cpptools/codelldb 的,有没有方法打印出具体的调用信息
xmake-vscode 调试,不用外置的 launch.json,插件内部会生成 launch.json 自动调起 debugger 。。你可以调下插件源码
我只是举例说明不用xmake,自己创建launch.json调试没问题。 刚用xmake又试了下,target platform设置成mingw就可以,windows则不行
可顺利调试:
{
__toolchains_mingw_x86_64 = {
"envs",
"mingw",
"yasm",
"nasm",
"fasm",
"go"
},
arch = "x86_64",
buildir = "build",
ccache = true,
host = "windows",
kind = "static",
mingw = [[C:\MinGW]],
mode = "release",
ndk_stdcxx = true,
plat = "mingw"
}
无法进入断点:
{
__toolchains_windows_x64 = {
"gcc"
},
arch = "x64",
buildir = "build",
ccache = true,
host = "windows",
kind = "static",
mode = "release",
ndk_stdcxx = true,
plat = "windows",
toolchain = "gcc"
}
这是什么原因
windows 平台主要是给 msvc 用的,你要用 gcc ,建议切到 mingw 平台,单纯切 gcc toolchain ,平台还是 windows 我不确定是否有其他问题,我现在也没类似的环境去调试。。既然 mingw 可以,就走 mingw,要么就 windows 平台 不要去切 gcc ,走 msvc
好的,感谢解答。 大佬这里能不能搞个检测,对于未预料的配置组合抛个警告,应该可以避免一部分我这样的情况
Xmake 版本
xmake v2.8.3+master.4ea057304
操作系统版本和架构
Windows 版本号: 22H2 操作系统内部版本:19045.3448
描述问题
工程创建好后,在vscode的底部用xmake工具栏进行了build和运行,结果都符合预期,程序正常编译和执行了。但是点击小蜘蛛进行调试,能看到程序已经执行并停住,一直按单步调试程序不会在源码窗口中停住,直到程序终止。![image](https://github.com/xmake-io/xmake-vscode/assets/28592567/1da0e500-89b8-493f-9f68-695725fb97cb)
期待的结果
停在断点处
工程配置
target("hello") set_kind("binary") add_files("hello.c")
附加信息和错误日志
无