vscode-remote-release
vscode-remote-release copied to clipboard
GDB configuration does not work on Jenkins server
I am trying to debug C++ code on a Jenkins server over SSH in VS Code. My host computer is running Ubuntu Linux, and the Jenkins server is running Debian Linux. But I am not able to get to work. It works fine locally (on the host computer). For example, I create a simple C program, test.c:
#include <stdio.h>
int main() {
int a = 2;
int b = 3;
int sum = a + b;
printf("sum = %d\n", sum);
return 0;
}
and compile it with debugging symbols:
gcc -g -O0 test.c -o my_test
Then, in VS Code I create this configuration within launch.json
{
"name": "Testing GDB locally",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/my_test",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
This works fine, but when I try to transfer the same procedure to the Jenkins server using SSH and the remote development extension, the debugging process just hangs.
I have installed Visual Studio Code Remote Development Extension Pack and set it up with SSH to a Jenkins server
Then, I installed the following extensions on the remote:
I use the following configuration in launch.json:
{
"name": "Simple C program",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/my_test",
"args": [],
"stopAtEntry": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"launchCompleteCommand": "None",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
},
},
When I press F5 to start debugging, I get the following output in the debugger console: https://pastebin.com/t4QVu2g0. The VS Code terminal is empty, and the debugging toolbar buttons for "Continue", "Step over", "Step into", "Step out", are all grayed out. The only thing I can do is click the "Stop" button ("Pause" does not work).
Note: This question was first asked on stackoverflow here: https://stackoverflow.com/q/78010230/2173773