Need help debugging with GDB+gdbserver

  • When conducting remote debugging on the Luckfox Pico using GDB and gdbserver, ensure that you have set it up following the steps below:


    1. Launch gdbserver on Luckfox Pico
    Execute the following command on the target platform, replacing <HOST_IP> with the host's IP address, <PORT> with the port number gdbserver is listening on, and <YOUR_PROGRAM> with the executable you want to debug:

    Code: Select all

    gdbserver <HOST_IP>:<PORT> <YOUR_PROGRAM>
    
    For example:
    gdbserver 192.168.10.99:1234 test
    
    This will start gdbserver on the Luckfox Pico, listening for connections from GDB.


    2. Start GDB on the host
    On the host machine, use GDB with the same architecture as the target platform. Execute the following command:

    Code: Select all

    arm-rockchip830-linux-uclibcgnueabihf-gdb
    
    Once in GDB, execute the following command, replacing <DEVELOPMENT_BOARD_IP> and <PORT> with the IP address and listening port number on Luckfox Pico:

    Code: Select all

    target remote <DEVELOPMENT_BOARD_IP>:<PORT>
    
    For example:
    target remote 192.168.10.100:1234
    
    This will connect GDB to the remote gdbserver.


    3. Run debugging commands on the host
    Use standard GDB commands for setting breakpoints, single-stepping, etc. For example:
    • Set a breakpoint: break <function_name>
    • Single-step: step
    • Continue execution: continue
  • Remote debugging with GDB+gdbserver

    For example:

    Code: Select all

    gdbserver 192.168.0.11:2000 hello
    arm-rockchip830-linux-uclibcgnueabihf-gdb
    file ./hello
    target remote 192.168.0.11:2000
    
    
    For example: launch.json for VScod

    Code: Select all

    {
        // 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": "Remote Debugging",
                        "type": "cppdbg",
                        "request": "launch",
                        "program": "${workspaceFolder}/build/hello", // Шлях до вашого виконуваного файлу на цільовому пристрої
                        "args": [],
                        "stopAtEntry": false,
                        "cwd": "${workspaceFolder}",
                        "environment": [],
                        "externalConsole": true,
                        "MIMode": "gdb",
                        "miDebuggerPath": "arm-rockchip830-linux-uclibcgnueabihf-gdb", // Шлях до вашого виконуваного файлу GDB на вашому хості
                        "miDebuggerServerAddress": "192.168.0.11:2000", // Адреса та порт вашого віддаленого GDB-сервера
                        "setupCommands": [
                            {
                                "description": "Enable pretty-printing for gdb",
                                "text": "-enable-pretty-printing",
                                "ignoreFailures": true
                            }
                        ],
                        "serverLaunchTimeout": 5000,
                        "filterStderr": false,
                        "filterStdout": false,
                        "targetArchitecture": "arm" // Архітектура цільового пристрою
                    }
                ]
            }
    
  • I use the following command to transfer the test program

    Code: Select all

      scp -r /home/uzfm/test root@192.168.0.9:/root/test 
    in the terminal it shows that it is copied, but in fact it is not.
    Сan someone help how to correctly copy the program to the development board?
  • The command you executed seems to have no errors. If 192.168.0.9 is the IP address of the development board, and the transfer is showing as successful on the host, you should be able to see the file on the development board.

    Please verify whether 192.168.0.9 is indeed the IP address of the development board, or try changing to another transfer method:
    https://wiki.luckfox.com/Luckfox-Pico/L ... -Transfer/
  • I checked everything.
    Maybe it sees that the catalog already exists and does not update it?
  • 1. Use the buildroot image provided by the network disk.
    2. Ensure that the host and the development board are on the same local network and can ping each other.
    3. Use SSH for the transfer.
  • When I try to run the program, it ends.
    Can anyone help with this problem?

    There was a problem when debugging the rknn_yolov5_demo program. the program is compiled and works well, but when debugging there is a problem.

    This is from visual code.

    Code: Select all

    Process /root/RV1106_RV1103/rknn_yolov5_demo/build/rknn_yolov5_demo created; pid = 2794
    Listening on port 2000
    Remote debugging from host 192.168.0.18, port 51596
    /root/RV1106_RV1103/rknn_yolov5_demo/build/rknn_yolov5_demo: can't load library 'librknnmrt.so'

    Debugging information is present.
    command (l ) starts to show information from the end of main.

    This is from the terminal

    Code: Select all

    (gdb) target remote 192.168.0.5:2000
    Remote debugging using 192.168.0.5:2000
    Reading symbols from /home/uzfm/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot/lib/ld-uClibc.so.0...(no debugging symbols found)...done.
    0xa6fe9138 in _start () from /home/uzfm/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot/lib/ld-uClibc.so.0
    (gdb) continue
    Continuing.
    [Inferior 1 (process 758) exited with code 020]
    opencv-mobile example debugs great!
    The debugging issue arises when using the librknnmrt.so library.
  • Can someone explain what the problem is when debugging?
    Знімок екрана з 2024-02-25 14-10-08.png