microsoft / microsoft/vscode-cpptools
Control gdb output to Debug Console
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: Windows 10.0. 4393 x64
- VS Code Version: 1.25.1
- C/C++ Extension Version: 0.17.6
- Using mingw-w64 8.1.0
Using a minimal example for a sample program:
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
It would be nice to have more control over what gdb messages are printed in the Debug Console.
launch.json provides logging options for moduleLoad, engineLogging, trace, exceptions, programOutput, traceResponse, but it seems as though most gdb messages are grouped under programOutput. Sometimes I just want to see my program output when debugging, without the clutter from other gdb commands/events, but I haven't found a way to achieve that.
Adding --silent to miDebuggerArgs and set print thread-events off to setupCommands can turn off the gdb startup message and New thread/Thread exited messages in the Debug Console. But unless I completely disable programOutput (and lose the output stream), the following gets printed on every run:
=thread-group-added,id="i1"
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
=library-unloaded,id<...>
=library-unloaded,id<...>
...
It can be very verbose, and I haven't been able to find a way to disable it using gdb commands.
I'm not sure whether this request is best suited for here or the MIEngine project?
For reference, full launch and tasks configurations:
launch.json
"configurations": [
{
"preLaunchTask": "Build gcc",
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"internalConsoleOptions": "openOnSessionStart",
"MIMode": "gdb",
"miDebuggerPath": "C:/MinGW/mingw64/bin/gdb.exe",
"miDebuggerArgs": "--silent",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Reduce gdb verbosity",
"text": "set print thread-events off",
"ignoreFailures": true
}
],
"logging": {
"moduleLoad": false,
"engineLogging": false,
"trace": false,
"exceptions": false,
"programOutput": true,
"traceResponse": false
}
}
]
tasks.json
"tasks": [
{
"label": "Build gcc",
"type": "shell",
"command": "g++",
"args": [
"-ggdb",
"\"${relativeFile}\"",
"-o",
"\"build/${fileBasenameNoExtension}.exe\""
],
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
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 reviewing the launch.json logging configuration, especially programOutput, and the related MIEngine project named in the report; tasks.json only describes the build setup. Determine where GDB messages and program output are grouped, then define a way to control them independently while preserving program output when requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100