microsoft / microsoft/vscode-cpptools

Control gdb output to Debug Console

Abierto
#2,273 4 comentarios 6 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

debugger Feature Request help wanted
Lenguaje dominante
TypeScript
Estrellas
6.2k
Forks
1.7k
Merge medio
14 h 46 min
PR fusionados (30 d)
61

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza revisando la configuración de registro de launch.json, especialmente programOutput, y el proyecto MIEngine relacionado mencionado en el informe; tasks.json solo describe la configuración de compilación. Determina dónde se agrupan los mensajes de GDB y la salida del programa, y luego define una forma de controlarlos de manera independiente, conservando la salida del programa cuando se solicite.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp, typescript, vscode
Área
devtools
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.