站長資訊網
        最全最豐富的資訊網站

        vscode如何使用gdb調試

        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進行調試。

        贊(0)
        分享到: 更多 (0)
        網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號
        主站蜘蛛池模板: 国产精品国产三级在线专区| 欧美日韩精品系列一区二区三区国产一区二区精品 | 久久99久久99小草精品免视看| 四虎成人精品在永久在线| 99视频在线精品国自产拍亚瑟| 精品久久8x国产免费观看| 亚洲国产精品丝袜在线观看| 国产精品最新国产精品第十页| 精品国产麻豆免费人成网站| 国产亚洲色婷婷久久99精品| 亚洲精品高清无码视频| 日韩专区亚洲精品欧美专区| 国产午夜福利精品久久| 亚洲国产精品成| 国产亚洲精品国产| 国产精品高清一区二区三区| 亚洲精品无码乱码成人| 四虎国产精品永久在线看| 久久精品国产72国产精福利| 国产精品自在拍一区二区不卡| 欧美国产日本精品一区二区三区| 99久久99这里只有免费费精品| 无码人妻精品一区二区三| 午夜天堂精品久久久久| 亚洲精品无码高潮喷水在线| 亚洲精品自产拍在线观看| 午夜精品一区二区三区在线视| 欧美精品三区| 亚洲国产精品一区二区三区久久| 麻豆精品视频在线观看91| 久久久久一级精品亚洲国产成人综合AV区| 99久久精品国产毛片| 亚洲无删减国产精品一区| 99久久精品国产一区二区蜜芽| 91精品国产成人网在线观看| 国产精品 日韩欧美| 精品成人一区二区三区四区| 精品国产一区二区三区在线观看| 精品国产毛片一区二区无码| 久久久精品波多野结衣| 亚洲国产婷婷综合在线精品|