gpt4 book ai didi

c++ - 在 vscode 中运行时无法暂停或设置断点

转载 作者:行者123 更新时间:2023-12-03 07:03:46 29 4
gpt4 key购买 nike

我目前正在使用 Qemu for i368 开发一个(简单)内核。
我使用的是普通的 makefile 并通过 GDB 调试到 Qemu 工作完美
我搬到了 CMake,由于某种原因,我只能在我的代码已经在断点中时才能打断点。

我也不能暂停,我从调试窗口得到的反馈是暂停成功
设置断点时它告诉我尝试绑定(bind)断点

一个提示可能是,当我停止调试 session 时,我会从 vscode 弹出一个提示超时

我的启动.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": "Launch with GDB",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"cwd": "${workspaceRoot}",
"args": [],
"targetArchitecture": "x86",
"MIMode": "gdb",
"miDebuggerPath": "/bin/gdb",
"miDebuggerArgs": "",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
},
"customLaunchSetupCommands": [
{
"text": "target remote localhost:1234",
"description": "Connect to QEMU remote debugger"
}
],
"setupCommands": [
{
"text": "file ${command:cmake.launchTargetPath}",
"description": "Load binary."
},
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],

}
]

}

暂停响应
<--   C (pause-67): {"command":"pause","arguments":{"threadId":1},"type":"request","seq":67}
--> R (pause-67): {"type":"response","request_seq":67,"success":true,"command":"pause","body":{},"seq":1321}

设置断点时的响应:
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (340258) Send Event AD7BreakpointErrorEvent\n"},"seq":1327}
1: (340258) Send Event AD7BreakpointErrorEvent
--> R (setBreakpoints-69): {"type":"response","request_seq":69,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":4,"verified":true,"line":73}]},"seq":1329}
--> E (breakpoint): {"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":4,"verified":false,"message":"Attempting to bind the breakpoint....","line":73}},"seq":1331}

如果我在 Qemu 终端中输入 stop ,那么 vscode 就会停止,我可以再次设置断点。

最佳答案

我有同样的问题,但还没有解决。
但我发现了一些可能对你有用的东西。
根据他们在这个问题下的讨论:https://github.com/Microsoft/vscode-cpptools/issues/833
你可以试试

  • 将调试器的目标异步设置为关闭:
  •     "setupCommands": [
    {
    "text": "set target-async off"
    }
  • 将 SIGINT 发送到本地调试器进程
  •     -exec -interpreter-exec console "signal 2"
    看看它是否可以暂停。

    关于c++ - 在 vscode 中运行时无法暂停或设置断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62424216/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com