In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to debug vscode using gdb. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
1. Vscode launches the debug window
Press Ctrl+Shift+D to open the Debug window
The default is "No configurations". If you click "F5", you will be prompted to configure the GDB parameter (select gcc build and debug active file). The name of the configuration file is launch.json (configuration reference 3).
After the configuration is complete, press F5, and you will be prompted to configure GCC, select "Configure Task", select "C _ Configure Task", select "C _ build and debug active file", and the name of the configuration file 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": the address of the compiled chain
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 visit" "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 debug (including path, preferably absolute path, to avoid trouble)
"miDebuggerServerAddress": address and port of the server
"cwd": the path of debugging degree
"miDebuggerPath": the path of gdb
4. Compile and run GDB server
1) compilation
When p53 compiles, 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=0GDB requires libstdc++.so.6 libraries to run, so you need to turn this switch on. . / cool 3 gdb_build waits for completion
The compiled file is 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 manrenyinshan@renyinshan:~/work/p53/build$ ls.. / apps/gdb/installgdbserver/bin/mips -linux-gdbserverrenyinshan@renyinshan:~/work/p53/build$
Description:
The mips-linux-gdb of the install/bin directory is required for the configuration in vscode
The mips-linux-gdbserver in the installgdbserver/bin/ directory, which needs to be copied to the board
2) ssh login device, download gdbserver to / tmp directory, and add + x permission
3) ssh log in to the device, download the executable to the / tmp directory, and add + x permissions
4) run
/ tmp #. / mips-linux-gdbserver: 10000. / test debugging output: / tmp #. / mips-linux-gdbserver: 10000 test Process / tmp/test created; pid = 22608Listening on port 10000Remote debugging from host 192.168.0.245APP is running!
Remarks:
1) the downloaded executable program must be compiled by the compilation chain required by the device.
2) GCC compiled configuration and GDB references 1 and 2 when debugging by F5 in vscode
5. Debugging
Ready to complete, debug in VSCode.
On the use of vscode gdb debugging methods to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.