vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Unable to start debugging. Unexpected GDB output from command "-exec-run"

Open Omcsesz opened this issue 2 years ago • 6 comments
trafficstars

Environment

  • OS and version: Windows_NT x64 10.0.19045
  • VS Code: 1.77.3 (user setup)
  • C/C++ extension: v1.14.5
  • OS and version of remote machine (if applicable): none
  • GDB / LLDB version: GNU gdb (GDB) 13.1

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Create a simple helloworld project, with the "code ." command
  2. Create a main.c file in the project with the following content:
#include <stdio.h>

void main(void){
    printf("Hello World!\n");
}
  1. Open debug view
  2. Click on start debugging (F5)
  3. See the following error message: errorMessage

Debugger Configurations

tasks.json:
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\cygwin64\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
launch.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "targetArchitecture": "x64",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "c:/Users/Omar Sweidan/source/helloworld",
      "program": "c:/Users/Omar Sweidan/source/helloworld/main.exe",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    },
    {
      "name": "(Windows) Launch",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "enter program name, for example ${workspaceFolder}/a.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "console": "externalTerminal"
    }
  ]
}

Debugger Logs

1: (810) <-logout
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (812) Send Event AD7ProgramDestroyEvent\r\n"},"seq":340}
1: (812) Send Event AD7ProgramDestroyEvent
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"The program 'c:\\Users\\Omar Sweidan\\source\\helloworld\\main.exe' has exited with code 0 (0x00000000).\r\n\r\n"},"seq":342}
The program 'c:\Users\Omar Sweidan\source\helloworld\main.exe' has exited with code 0 (0x00000000).

--> E (exited): {"type":"event","event":"exited","body":{"exitCode":0},"seq":344}
--> E (terminated): {"type":"event","event":"terminated","body":{},"seq":346}
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/DebugCompleted","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"17.4.21117.1","VS.Diagnostics.Debugger.HostVersion":"17.4.21117.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.DebugCompleted.BreakCounter":0}},"seq":348}
<--   C (disconnect-9): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":9}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (826) <--gdb-exit\r\n"},"seq":351}
1: (826) <--gdb-exit
--> R (disconnect-9): {"type":"response","request_seq":9,"success":true,"command":"disconnect","body":{},"seq":353}

Other Extensions

No response

Additional Information

I would like to know if this is a bug in gdb, or the extensions. Also it would be good if the error would contain more information on what I did wrong.

Omcsesz avatar Apr 28 '23 16:04 Omcsesz