我正在 ARM-64 中设置操作。 我想知道是否可以使用在 ubuntu 18.04 下运行的 Visual Studio 代码对其进行调试。
到目前为止,我能够在 QEMU 中编译和运行 op-tee。 并且还能够使用命令行 gdb 连接 gdb 服务器(点击此链接:https://www.op-tee.org/docs/debug/)。
现在我想使用一些 GUI 而不是 gdb。由于我正在使用Visual Studio Code,所以我想知道是否可以配置vsCode来执行此操作?
我尝试过安装 cortex-debug 扩展(我不确定它是否正确),并且还尝试了 c/c++ 调试附加。但我不能让他们工作!
这是我的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",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/optee_os/out/arm/core/tee.elf",
"miDebuggerServerAddress": "localhost:1234",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "optee"
}
]
},
{
"cwd": "${workspaceRoot}",
"executable": "${workspaceFolder}/optee_os/out/arm/core/tee.elf",
"name": "Debug Microcontroller",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd"
}
]
}
我希望能够通过使用Microsoft可视化代码远程连接到在 QEMU 下运行的 gdb 服务器来调试 arm 应用程序。
任何使用扩展的建议都值得赞赏。
我找到了适合我的解决方案:
首先,需要安装 VS Code 的本机调试扩展。
然后将以下配置添加到 launch.json 文件中:
{
"type": "gdb",
"request": "attach",
"name": "Attach to QEMU",
"executable": "${workspaceFolder}/optee_os/out/arm/core/tee.elf",
"target": "localhost:1234",
"remote": true,
"cwd": "${workspaceRoot}",
"gdbpath": "~/devel/optee/toolchains/aarch64/bin/aarch64-linux-gnu-gdb"
}
笔记:
- 仅当应用程序未运行时,才能连接到 QEMU:
- 在 QEMU 中键入 c 之前,它应该处于初始状态
- 或者在断点处停止
- 不应有其他客户端连接到它。
参考:
- http://austinhanson.com/vscode-gdb-and-debugging-an-os