microsoft / microsoft/vscode-cpptools
Output is not displayed in the integrated VS Code Debug Console when stepping over output instructions
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
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.47.3
- C/C++ Extension Version: 0.29.0
- Other extensions you installed (and if the issue persists after disabling them): None
- When stepping over output lines like
printf(), no output is displayed in the integrated VS Code Debug Console.
To Reproduce
Consider the following simple C code:
#include <stdio.h>
int main() {
printf("Connie\n");
return 0;
}
launch.json configuration:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "cl.exe - Compila ed esegui il debug del file attivo",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "C/C++: cl.exe build active file"
}
]
}
Steps to reproduce the behavior:
-
Set a breakpoint at the
printf("Connie\n")line. -
Select
Run | Start Debuggingfrom the menu. -
Step over the above
printf()line. -
See that no output is displayed in the Debug Console integrated window (screenshot attached).
Workaround
It seems that the problem is that the output is buffered. So, disabling output buffering with a line like the following seems to solve the problem and the output string is displayed immediately after stepping over it:
/* Disable output buffering */
setvbuf(stdout, NULL, _IONBF, 0);
However, this is not an intuitive behavior. It would be more developer friendly to just show the output when stepping over output lines. Or, at least offer an option to customize that behavior (like "bufferedOutput": true/false).

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 behavior with the provided C program, launch.json configuration, Windows setup, and integrated Debug Console. Investigate how stepping over printf() handles buffered output in the cppvsdbg configuration. Done means output is shown as expected when stepping, or the behavior is clearly exposed through a documented configuration option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100