使用VSC阅读代码有非常舒服的感觉,如果能再加上调试,那就更爽了,而很多开源项目本身也比较大,直接阅读代码还是有点困难的,所以最好还是上调试,调试也很简单,无非是调用gdb,所以先新建一个简单的任务tasks.json,用来指代编译过程,具体根据项目而定.
{
"tasks": [
{
"type": "shell",
"label": "Makefile",
"command": "make",
"problemMatcher": [],
}
],
"version": "2.0.0"
}
接着创建launch.json,来指代要调试的内容,比如假设我这里要看的是iproute2中的ip -6 address命令,那么就写下来.
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/ip/ip",
"args": ["-6","address"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Makefile"
}
]
}
最后按F5,顺利进入调试.
可以说非常简单了.
hi 大佬,https://www.taterli.com/5151/#comment-8369 这个的镜像能发下吗?另外,我a80 接那个刷机软件无法连接,你是怎么解决的呢?