gdbserver issues
Posted: 2025-04-29 9:34
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:
and in launch.json i start gdb from the toolchain that connects to remote. It should integrate with vscode to debug through brakepoints.
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.
However, when i set this breakpoint again during debugging session, it approaches this breakpoint as exception:
Then i got a message from gdbserver on my target board's console:
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!
and gdbserver from your buildroot sdk:
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"
}
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
}
],
}