Page 1 of 1

gdbserver issues

Posted: 2025-04-29 9:34
by 14Og
Hi! Recently i came across some issues while debugging my c++ applications that i cross-compile for my luckfox pico mini b. My setup is gdb from cross-toolchain:
photo_2025-04-29_12-04-39.jpg
and gdbserver from your buildroot sdk:
photo_2025-04-29_12-07-52.jpg
I use vscode IDE and have managed to setup all the processes via tasks.json and lauhch.json files. In tasks.json i have a task that calls gdbserver via sshpass:

Code: Select all

            {
                "label": "remote gdbserver",
                "type":"shell",
                "command": "sshpass",
                "options": {"cwd": "${workspaceFolder}"},
                "args": [
                    "-p",
                    "luckfox",
                    "ssh",
                    "root@cyclops",
                    "cd /root && LD_LIBRARY_PATH=/oem/usr/lib:/oem/lib gdbserver :1234 ./cyc"
                ],
                "problemMatcher": [
                    "$tsc"
                ],
                "presentation": {
                    "reveal": "always"
                },
                "group": "test"
            }
and in launch.json i start gdb from the toolchain that connects to remote. It should integrate with vscode to debug through brakepoints.

Code: Select all

      {
        "name": "(gdb) Start",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/debug/cyc",
        "stopAtEntry": false,
        "miDebuggerServerAddress": "172.32.0.93:1234", // Target board's IP address and port
        "cwd": "${workspaceFolder}",
        "externalConsole": false,
        "MIMode": "gdb",
        "logging": {"engineLogging": true},
        "miDebuggerPath": "arm-rockchip830-linux-uclibcgnueabihf-gdb",  // gdb for target
        "setupCommands": [
          {
            "description": "Enable pretty printing for GDB",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          },
          {
            "description": "Set disassembly flavor to Intel",
            "text": "-gdb-set disassembly-flavor intel",
            "ignoreFailures": true
          },
          {
            "description": "Path for standard libraries",
            "text": "set sysroot target:/", // at target board
            "ignoreFailures": false
          },
          {
            "description": "Ignore SIGUSR1", // for IPC debugging
            "text": "handle SIGUSR1 nostop noprint pass",
            "ignoreFailures": false
          }
        ],
      }
The thing is this setup is very unstable. Right now im facing an issue when i set a breakpoint and debugger throws an error during start and can not set it.
photo_2025-04-29_12-14-20.jpg
However, when i set this breakpoint again during debugging session, it approaches this breakpoint as exception:
photo_2025-04-29_12-17-02.jpg
Then i got a message from gdbserver on my target board's console:
photo_2025-04-29_12-30-01.jpg
and cant debug anymore. It really makes development process almost impossible as i can not debug my program normally. I use debug preset in CMake with proper flags for debugging symbols creation, so the problem is not there. I wonder if it might be mismatching versions of gdb and gdbserver and the fact that i use some modern c++ features like variadic templates and auto... function arguments. Is there anything that i can do to try to solve this issue? I'm really tired of not being able to debug my apps normally. Thanks in advance!

Re: gdbserver issues

Posted: 2025-04-29 10:26
by Crocodile
Hello, most of the time I use GDB directly from the command line. In the following forum thread: viewtopic.php?t=103&hilit=gdb, I had a discussion with another user regarding the use of GDB, which you can refer to. Since I don't have experience using breakpoints and debugging with VSCode, I'm unable to provide help with the issue you're encountering.

Re: gdbserver issues

Posted: 2025-04-30 8:46
by 14Og
Aight, thanks! I've read this post already. The issue is seem to be related to the inability of gdb to process modern c++ code with auto function arguments. Thats quite sad, but at least now i know what to expect :)