Good references:
- https://medium.com/@spe_/debugging-c-c-programs-remotely-using-visual-studio-code-and-gdbserver-559d3434fb78
- https://github.com/dmrauch/vscode-cpp-remote-debug/
The setup:
- Local: MacOSX
- Remote: Ubuntu 16.04 in Docker
- install gdb --with-all-targets
- sign gdb
- setup vscode
.launch
as invscode-cpp-remote-debug
Launch docker with option
--security-opt seccomp:unconfined
Inside the container:
gdbserver :1234 build/app_to_debug
{
"name": "(gdb) cpp-app",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/project/app/build/app_to_debug",
"miDebuggerServerAddress": "0.0.0.0:1234",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"sourceFileMap": {
"/home/project/app/": "${workspaceRoot}/project/app"
},
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "gdb"
},
"windows": {
"MIMode": "gdb"
}
},