c# - VSCode dbg 将本地进程附加到调试 C# dll 使用的 C dll
问题描述
我想quickfuncs.dll
在 VSCode 中调试由 MinGW64 使用 -g (调试符号)编译的 C DLL 。此 DLL 由 C# DLL(也使用调试符号编译)使用,由以下人员运行:
"C:\Program Files\dotnet\dotnet.exe" exec "D:\Server\bin\Debug\netcoreapp2.0\Server.dll" Parameter1=test
我已经launch.json
根据https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md进行了配置
{
// 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
},
}
]
}
附加该过程后,无法使用此日志设置断点:
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"}
请问你能帮帮我吗?
解决方案
我在https://github.com/Microsoft/vscode-cpptools/issues/2452上找到了解决方案。
pieandcakes 写道:
使用 MinGW,您必须向被调试者发送 Ctrl+C 以暂停。暂停按钮不起作用,因为我们无法通过MI 协议发送SIGINT 。
gdb
我们通常使用的命令是-exec-interrupt
,但这不起作用。程序(不幸的是)是:
pause
在 UI 中点击- 转到调试器并按
Ctrl+c
。此时,被调试者应该停止。只有这样断点才能绑定。
这个解决方案对我有用。非常感谢。
推荐阅读
- katalon-studio - 从katalon中的默认包调用方法
- php - 尝试连接 MySQL 数据库时出现内部服务器错误
- javascript - 使用 javascript 更改子链接颜色
- gaussian - 手写数字数据集的高斯混合实现与光学识别
- r - 当我尝试应用熵计算时,如何解决二进制运算符错误的非数字参数?
- javascript - 如何在 laravel 中使用 ajax 调用删除路由?
- intellij-idea - “if”块上打开大括号后的换行符
- android - Android Studio 预览版未显示更改 JDK 的选项
- sql-server - 如何使用 split_string 更新内部连接表?
- flutter - 当我特别要求 hh:mm 时,DateFormat 将 yy-mm-dd 添加到 DateTime