microsoft / microsoft/vscode-cpptools

Control gdb output to Debug Console

Offen
#2,273 4 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

debugger Feature Request help wanted
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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"
    }
]

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Überprüfung der Logging-Konfiguration in launch.json, insbesondere von programOutput, sowie des zugehörigen MIEngine-Projekts, das im Bericht genannt wird; tasks.json beschreibt nur das Build-Setup. Ermittle, wo GDB-Nachrichten und Programmausgabe zusammengefasst werden, und definiere anschließend eine Möglichkeit, sie unabhängig voneinander zu steuern, wobei die Programmausgabe auf Anfrage erhalten bleiben soll.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, typescript, vscode
Bereich
devtools
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.