vscode如何使用gdb调试
1、vscode启动debug窗口
按Ctrl Shift D,打开Debug窗口
默认是“No configurations”, 点击“F5”,会提示你配置GDB参数(选择gcc build and debug active file),配置文件名称为launch.json(配置参考3)
配置完成后,再按F5, 会提示配置GCC,选择“Configure Task”, 选择“C/C : build and debug active file”, 配置文件名称为task.json(配置参考2)
2、GCC配置
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "type": "shell", "label": "gcc build active file", "command": "/usr/share/mips-gcc-4.6/staging_dir/bin/mips-linux-gcc", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "/usr/bin" }, "problemMatcher": [ "$gcc" ] } ] }
“command”: 编译链的地址
3、GDB配置
{ // 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": "gcc build and debug active file", "type": "cppdbg", "request": "launch", "miDebuggerServerAddress": "192.168.0.1:10000", "program": "/home/renyinshan/work/p53/apps/cmdlib/test", "args": [], "stopAtEntry": true, "cwd": "/home/renyinshan/work/p53/apps/cmdlib/", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "gcc build active file", "miDebuggerPath": "/home/renyinshan/work/p53/apps/gdb/install/bin/mips-linux-gdb" } ] }
“program”: 要调试的程序名(包含路径,最好绝对路径,免得麻烦)
“miDebuggerServerAddress”: 服务器的地址和端口
“cwd”: 调试程度的路径
“miDebuggerPath”: gdb的路径
4、GDB server编译及运行
1)编译
P53编译时,请打开如下开关; P59需要从编译链目录拷贝一个。
scripts/tozedap-router_4g_industry/config.tozedap-router_4g_industry:564:export NO_CPP_LIB=0 GDB运行需要libstdc++.so.6的库,所以需要把此开关打开。
./cool 3 gdb_build 等待完成即可
编译完成后的文件如下:
renyinshan@renyinshan:~/work/p53/build$ ls ../apps/gdb/install/* ../apps/gdb/install/bin: mips-linux-gdb mips-linux-gdb-add-index mips-linux-run ../apps/gdb/install/include: gdb ../apps/gdb/install/lib: libmips-linux-sim.a ../apps/gdb/install/share: gdb info locale man renyinshan@renyinshan:~/work/p53/build$ ls ../apps/gdb/installgdbserver/bin/ mips-linux-gdbserver renyinshan@renyinshan:~/work/p53/build$
说明:
install/bin 目录的mips-linux-gdb为vscode中配置需要的;
installgdbserver/bin/ 目录中的mips-linux-gdbserver,需要拷贝到板子中;
2)ssh登录设备,下载gdbserver到/tmp目录中, 并增加 x权限
3)ssh登录设备,下载可执行程序到/tmp目录中, 并增加 x权限
4)运行
/tmp # ./mips-linux-gdbserver :10000 ./test 调试输出: /tmp # ./mips-linux-gdbserver :10000 test Process /tmp/test created; pid = 22608 Listening on port 10000 Remote debugging from host 192.168.0.245 APP is running!
备注说明:
1) 下载的可执行程序,必须保证是设备所需编译链编译的;
2) vscode中按F5调试时,GCC编译的配置和GDB参考1和2;
5、调试
准备完成, 在VSCode进行调试。
相关推荐:vscode教程
以上是vscode如何使用gdb调试的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

首先,在电脑上打开vscode软件,点击左边的【Extension】(扩展)图标,如图中①所示然后,在扩展界面的搜索框中输入【officeviewer】,如图中②所示接着,从搜索结果中选择【officeviewer】安装,如图中③所示最后,打开文件,如docx,pdf等,如下图

首先要打开电脑中的visualstudiocode,点击左侧四个方块按钮然后在搜索框中输入draw.io查询插件,点击安装安装好后,新建一个test.drawio文件接着选中test.drawio文件,进入编辑模式左侧有各种图形,随意选择,就可以绘制流程图了绘制好后,点击文件→嵌入→svg下面再选择嵌入复制svg代码将复制的svg代码粘贴到html代码中打开html网页,就可以看到绘制的流程图了点击网页上的图片,就可以跳转页面在该页面可以放大缩小流程图在这里,我们选择点击右下角的铅笔图案,跳转网

LeanCopilot,让陶哲轩等众多数学家赞不绝口的这个形式化数学工具,又有超强进化了?就在刚刚,加州理工教授AnimaAnandkumar宣布,团队发布了LeanCopilot论文的扩展版本,并且更新了代码库。图片论文地址:https://arxiv.org/pdf/2404.12534.pdf最新实验表明,这个Copilot工具,可以自动化80%以上的数学证明步骤了!这个纪录,比以前的基线aesop还要好2.3倍。并且,和以前一样,它在MIT许可下是开源的。图片他是一位华人小哥宋沛洋,他是

1.首先,打开vscode软件,点击资源管理器图标,找到工作区窗口2.然后,点击左上角的文件菜单,找到将文件夹添加到工作区选项3.最后,在本地磁盘中找到文件夹位置,点击添加按钮即可

1.首先,打开界面后,点击左上角的文件菜单2.随后,在首选项栏目中点击设置按钮3.接着,在跳转的设置页面中,找到更新板块4.最后,鼠标点击勾选启用在Windows上后台下载和安装新的VSCode版本按钮,并重启程序即可

1.首先,打开设置菜单中的settings选项2.随后,在跳转的commonlyused页面中找到terminal栏目3.最后,在该栏目右侧取消勾选usewslprofiles按钮即可

1.首先,打开界面后,点击工作区界面2.然后,在打开的编辑面板中,点击文件菜单3.随后,点击首选项栏目下的设置按钮4.最后,鼠标点击勾选CursorSmoothCaretAnimation按钮,保存设置即可

1.首先,打开编辑窗口后,点击左下角的配置图标2.随后,在打开的子菜单中点击管理工作区信任按钮3.接着,在编辑窗口中找到该页面4.最后,根据自己的办公需求勾选相关指令即可
