1. vscode starts the debug window
Press Ctrl Shift D to open the Debug window
The default is "No configurations", click "F5", You will be prompted to configure GDB parameters (select gcc build and debug active file). The configuration file name is launch.json (Configuration Reference 3)
After the configuration is completed, press F5 again, you will be prompted to configure GCC, select "Configure Task", select "C/C: build and debug active file", the configuration file name is task.json (Configuration Reference 2)
2. GCC Configuration
{ // 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": Compile Chain address
3. GDB configuration
{ // 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": The name of the program to be debugged (including the path, preferably an absolute path to avoid trouble)
"miDebuggerServerAddress" : The address and port of the server
"cwd": The path of the debugging level
"miDebuggerPath": The path of gdb
4. GDB server compilation and operation
1) Compile
When compiling P53, please turn on the following switch; P59 needs to copy one from the compilation chain directory.
scripts/tozedap-router_4g_industry/config.tozedap-router_4g_industry:564:export NO_CPP_LIB=0 GDB运行需要libstdc++.so.6的库,所以需要把此开关打开。
./cool 3 gdb_build 等待完成即可
The compiled files are as follows:
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$
Instructions:
The mips-linux-gdb in the install/bin directory is required for configuration in vscode;
installgdbserver/bin/ The mips-linux-gdbserver in the directory needs to be copied to the board;
2) Log in to the device via ssh, download gdbserver to the /tmp directory, and add x permissions
3) Log in to the device via ssh, download the executable program to the /tmp directory, and add x permissions
4) Run
/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!
Remarks:
1) Download the executable program , it must be ensured that it is compiled with the compilation chain required by the device;
2) When pressing F5 to debug in vscode, refer to 1 and 2 for GCC compilation configuration and GDB;
5, debugging
Ready to complete, debug in VSCode.
Related recommendations: vscode tutorial
The above is the detailed content of How to use gdb debugging in vscode. For more information, please follow other related articles on the PHP Chinese website!

2022年了,该学会用VSCode debug了!下面本篇文章手把手带大家会习VSCode debug,希望对大家有所帮助!

本篇是VSCode配置文章,手把手教大家怎么在VSCode中配置使用 Geant4 和 Root,希望对大家有所帮助!

本篇文章扒拉一下vscode Prettier的选项,总结分享16个让你的代码变漂亮的属性,希望对大家有所帮助!

“工欲善其事,必先利其器!”,vscode作为前端开发的重要工具,其插件能大幅提升战斗力,精心收集12个插件,总有几款你还未曾拥有。

VSCode中如何开发uni-app?下面本篇文章给大家分享一下VSCode中开发uni-app的教程,这可能是最好、最详细的教程了。快来看看!

VScode中怎么开发置C/C++?怎么配置C/C++环境?下面本篇文章给大家分享一下Windows系统下VScode配置C/C++环境图文教程,希望对大家有所帮助!


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
