1 year ago
#189013

Alexis
Redirect stderr and stdout to terminal in visual studio code during cross debugging
I'm debugging a remote program using gdb on my host computer and gdbserver on my remote. Everything works fine except that I cannot figure out how to show stdout and stderror on the VS Code terminal.
I have created a launch.json which sets up the debugging environment. The launch json calls a tasks using the preLaunchTask option:
...
"MIMode": "gdb",
"targetArchitecture": "arm64",
"preLaunchTask": "debug_preparation",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
...
The debug_preparation task looks like the following:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "debug_preparation",
"command": "sh",
"args": ["start_debug_session.sh"],
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "new",
"showReuseMessage": false,
"clear": false,
"close": false
}
}
]
}
Do you have an idea of what is missing?
Maybe, the VS Code terminal is not the right place to do so. If that's the case, I'm happy with any other option.
The only workaround that I have is to start the gdbserver on the remote with the following:
ssh -n -f $USER@$TARGETIP "sh -c 'nohup gdbserver localhost:4444 ${FULL_REMOTE_PATH} > /output/stdout.txt 2>/output/stderr.txt &'"
but it's kind of annoying to always ssh into the remote and open these files to see wath went wrong.
bash
visual-studio-code
gdb
sh
gdbserver
0 Answers
Your Answer