【问题标题】:Can't pause or set breakpoint when running in vscode在 vscode 中运行时无法暂停或设置断点
【发布时间】:2020-10-06 23:45:09
【问题描述】:

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

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

提示可能是,当我停止调试会话时,我会从 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 就会停止,我可以再次设置断点。

【问题讨论】:

  • 您是否使用debug 标志编译内核?
  • 是的 - 通过构建发布/调试检查了这一点,我看到调试版本大约大了 60%。我也做了文件 它说它没有被删除调试符号

标签: c++ visual-studio-code gdb qemu


【解决方案1】:

我遇到了类似的问题,尝试使用选项 ""MIDebuggerServerAddress": "targetIp:port" 连接远程目标,而不是 customLaunchSetupCommands 中的命令。

【讨论】:

    【解决方案2】:

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

    1. 将调试器的 target-async 设置为关闭:
        "setupCommands": [
        {
        "text": "set target-async off"
        }
    
    1. 向本地调试器进程发送 SIGINT
        -exec -interpreter-exec console "signal 2"
    

    看看它是否可以暂停。

    【讨论】:

      猜你喜欢
      • 2022-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-23
      • 2013-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多