板子:hi3556v200
交叉编译工具:arm-himix200-linux
主机:win10+虚拟机的ubuntu16.4
gdb:gdb-8.2.tar.gz
1.在ubuntu交叉编译gdb(Remote 'g' packet reply is too long解决)
2. 在ubuntu交叉编译gdbserver
3.使用步骤
例子程序testProgram编译的时候需要加入-g参数
结果:
4.vscode远程调试
4.1ubuntu装ssh服务器
4.2 vscode装好ssh插件并链接ubuntu
然后配置
输入ssh xxx(ubuntu名称)@xxxxxx(ip地址)
远程调试最主要是配置vscode调试json文件 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": [
{
"type": "cppdbg",
"request": "launch",
"name": "Debug for test",
"skipFiles": [
"<node_internals>/**"
],
"args": [],
"program": "${workspaceFolder}/testProgram",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath":"/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gdb",
"miDebuggerServerAddress": "192.168.10.10:1234"
}
]
}
type:调试的类型
name:配置文件的名字
request:配置文件的请求类型,有 launch 和 attach 两种,具体看官方文档
program:可执行文件的路径和文件名称
args:主函数调用时传入的参数
stopAtEntry:设为true时程序将暂停在程序入口处
cwd:调试时的工作目录
externalConsole:调试时是否显示控制台窗口
MIMode:指定 VS Code 连接的调试器,必须为 gdb 或者 lldb
miDebuggerPath:调试器路径,这个需要修改为上面编译好的那个,我这里是替换了海思原来的gdb工具
miDebuggerServerAddress: 板子 ip