Description:
I’m experiencing an issue with remote debugging using GDB and VS Code where breakpoints in shared libraries are not binding correctly. Below are the details of my setup and the steps I have taken:
Setup:
Development Environment: VS Code on my laptop (Ubuntu)
Target Device: Raspberry Pi
Debugger: gdbserver running on Raspberry Pi, GDB Multiarch on laptop
Project Structure:
Main executable: ${workspaceRoot}/build/rpi/usr/bin/my-executable
Shared libraries located at: ${workspaceRoot}/build-output/lib
{
"version": "0.2.0",
"configurations": [
{
"type": "cppdbg",
"request": "launch",
"name": "Attach to gdbserver",
"program": "${workspaceRoot}/build/rpi/usr/bin/my-executable",
"miDebuggerServerAddress": "192.168.1.100:1234",
"cwd": "${workspaceRoot}",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Load shared library symbols",
"text": "set solib-search-path /home/user/projects/my-project/lib"
}
],
"externalConsole": true,
"MIMode": "gdb",
"additionalSOLibSearchPath": "${workspaceRoot}/build-output/lib",
"miDebuggerArgs": "${workspaceRoot}/build-output/lib",
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
}
}
]
}
Problem:
Despite setting the solib-search-path and ensuring that the shared libraries are compiled with debug symbols using the -g flag, breakpoints in the shared libraries are not binding. The breakpoints in the main executable work fine, but those in the shared libraries are ignored.
Steps Taken:
Ensured Debug Symbols: All shared libraries are compiled with the -g flag.
Set solib-search-path: Added set solib-search-path /home/user/projects/my-project/lib to the setupCommands.
Used additionalSOLibSearchPath: Set the additional symbol search path to ${workspaceRoot}/build-output/lib.
Configured Debugger Arguments: Added miDebuggerArgs with the path to the shared libraries.
Elias Nowak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.