【问题标题】:Vscode+Qemu+TinyOS Can‘t Using GUI gdbvscode+Qemu+TinyOS 无法使用 GUI gdb
【发布时间】:2019-12-07 05:04:14
【问题描述】:

我正在按照本教程在 Ubuntu18.04 http://www.jamesmolloy.co.uk/tutorial_html/ 下设置一个微型操作系统。

到目前为止,我能够在 QEMU 中编译和运行微型内核。并且还能够使用命令行 gdb 连接 gdb-server。

qemu -S -s -fda floppy.img -boot a &
sleep 1
cgdb -x scripts/gdbinit

但我想使用 Vscode gdb GUI 而不是命令行 gdb,所以我搜索这个页面https://wiki.osdev.org/User:TheCool1Kevin/VSCode_Debug 来设置 json 文件。 这是我的 launch.json 文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch with GDB",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/boot/boot.o",
            "cwd": "${workspaceRoot}",
            "args": [],
            "targetArchitecture": "x86",
            "MIMode": "gdb",
            "miDebuggerPath": "",
            "miDebuggerArgs": "",
            "customLaunchSetupCommands": [],
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "text": "file ${workspaceRoot}/cmy_kernel",
                    "description": "Load binary."
                },
                {
                    "text": "target remote :1234",
                    "description": "connect the port"
                },
                {
                    "text": "break kern_entry",
                    "description": "Break on exception handler."
                },
            ],
            "preLaunchTask": "Launch QEMU"
        }
    ]
}

而我的 task.json 是

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Launch QEMU",
      "type": "shell",
      "windows": {
          "command": ""
      },
      "linux": {
          "command": "qemu -S -s -fda floppy.img -boot a &sleep 1 &"
      }
  }
  ]
}

我希望能够调试VScode下的代码,但是当我开始调试时,VScode显示无法连接服务器:1234超时。

我不知道如何修改文件。任何使用扩展的建议都值得赞赏。

【问题讨论】:

    标签: gdb qemu vscode-debugger


    【解决方案1】:

    你试过这个 vs 扩展https://github.com/WebFreak001/code-debug

    由于 -s 命令部署服务器或端口:1234 您可以使用此配置来附加它。

    {
                "name": "Debug",
                "type": "gdb",
                "request": "attach",
                "target": "localhost:1234",
                "remote": true,
                "gdbpath": "gdb",
                "cwd": "${workspaceRoot}",
                "valuesFormatting": "parseText",
     }
    

    【讨论】:

      猜你喜欢
      • 2011-06-09
      • 2019-10-25
      • 1970-01-01
      • 1970-01-01
      • 2013-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-05
      相关资源
      最近更新 更多