我想调试C DLL quickfuncs.dll
,该DLL由MinGW64在VSCode中用-g(调试符号)编译。此DLL由C#DLL(也使用调试符号进行编译)使用,由以下程序运行:
"C:\Program Files\dotnet\dotnet.exe" exec "D:\Server\bin\Debug\netcoreapp2.0\Server.dll" Parameter1=test
我已基于https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md配置了launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach to process",
"type": "cppdbg",
"request": "attach",
"program": "C:/Program Files/dotnet/dotnet.exe",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"miDebuggerPath": "c:/msys2/mingw64/bin/gdb.exe",
"targetArchitecture": "x64",
"additionalSOLibSearchPath": "${workspaceFolder}/bin/Debug/win64/;d:\\Server\\src\\Server\\WorkingDirectory\\",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false,
}
],
"logging": {
"trace": true,
"traceResponse": true
},
}
]
}
在附加该过程之后,无法使用此日志设置brakpoint:
C setBreakpoints: {"source":{"name":"api.c","path":"D:\\c_code\\quickfuncs\\api.c"},"lines":[246],"breakpoints":[{"line":246}],"sourceModified":false}
R: {"success":true,"message":null,"request_seq":11,"command":"setBreakpoints","body":{"breakpoints":[{"id":3,"verified":true,"line":246,"message":null}]},"running":false,"refs":null,"seq":0,"type":"response"}
E breakpoint: {"reason":"changed","breakpoint":{"id":3,"verified":false,"line":246,"message":"Attempting to bind the breakpoint...."},"type":"breakpoint"}
可以帮我吗?
答案 0 :(得分:0)
我在https://github.com/Microsoft/vscode-cpptools/issues/2452上找到了解决方案。
pieandcakes写道:
使用MinGW,您必须将Ctrl + C发送到调试对象以暂停。暂停 按钮不起作用,因为我们无法通过
gdb
发送 SIGINT MI协议。我们通常使用的命令是-exec-interrupt
,但是 那行不通。程序(不幸的是)是:
- 在用户界面中点击
pause
- 转到调试对象,然后按
Ctrl+c
。此时,调试对象应停止。只有这样 断点绑定。
此解决方案对我有用。非常感谢。