microsoft / microsoft/vscode-cpptools
No output prints when debugging app in linux docker container from macOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
- OS and Version: macOS 11.2.1
- VS Code Version: 1.53.2
- C/C++ Extension Version: 1.2.2
VSCode runs on Mac, C++ application runs on a linux container (Ubuntu) with gdbserver, gdb used to debug is also taken from the linux container.
I'm able to debug, I can step over, step into, continue, set breakpoints, everything works OK, except I do not see any output print (std::cout) done by the application. I do not see anything in the DEBUG CONSOLE (as indicated in #3968) besides the gdb traces; I do not see any external console (I'm setting "externalConsole" to "true"), even after doing the work around explained here to force the first appearance of the terminal (if I just run this Open Terminal task, yes, a terminal appears). I've also enabled logging ("logging": { "engineLogging": true, "trace": true, "traceResponse": true }), which just prints more debug traces but not the C++ application prints.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDBSERVER)",
"type": "cppdbg",
"request": "launch",
"miDebuggerServerAddress": "localhost:2000",
"preLaunchTask": "start-gdbserver",
"miDebuggerPath": "${workspaceRoot}/docker_wrapper_gdb.sh",
"targetArchitecture": "x64",
"program": "${workspaceRoot}/src/lr/bin/lr.bin",
"args": [],
"stopAtEntry": true,
"externalConsole": true,
"cwd": "${workspaceRoot}",
"sourceFileMap":{
"${workspaceRoot}": "${workspaceRoot}"
},
"environment": [],
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
}
]
}
Note: docker_wrapper_gdb.sh is just a script to call the gdb from the linux container.
tasks.json
{
"label": "start-gdbserver",
"type": "shell",
"command": "docker exec -d devenv gdbserver :2000 ./src/lr/bin/lr.bin",
"problemMatcher": []
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the remote debugging setup described in launch.json and tasks.json, including docker_wrapper_gdb.sh, with the C++ app running under gdbserver. Trace how application stdout is routed for externalConsole and the DEBUG CONSOLE; done means std::cout output is visible during this macOS-to-Linux-container session without breaking existing debugging controls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, docker, linux, macos
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100