我们正在使用 9.2.0 版的 GCC 工具链 (MinGW-w64) 开发 Win64 DLL。作为 IDE,我们使用 VisualStudio Code(版本 1.47.3)和微软的 C/C++ IntelliSense、调试和代码浏览插件(版本 0.30.0)。
不幸的是,我们不能在 DLL 中设置任何断点。
如果我们使用 LoadLibrary 将 DLL 静态或动态附加到 TestApplication 中,情况也是如此。
将 GDB 作为控制台进程启动允许我们在 DLL 中设置断点并在该行停止,但是我们错过了 IDE 的便利性。我假设 VSCode 项目的配置或 C/C++ 插件中存在问题。
我们使用以下 launch.json 文件:
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/Win64/TestApplication.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "${workspaceFolder}/minGW-w64/bin/gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
],
"preLaunchTask": "build-all",
"avoidWindowsConsoleRedirection": true,
"logging": {
"trace": false,
"traceResponse": false,
"engineLogging": true
}
}
]
}
更新:2020 年 8 月 17 日:原因是 DLL 中缺少符号,无法加载。即使我在调试器启动时尝试加载 DLL 的符号文件,它也会在加载主机应用程序时删除这些符号。我发现的唯一解决方法是在我只能通过其地址输入的第一个断点内手动重新加载符号文件。
是否有人能够使用相同的工具链调试 Win64 DLL?