microsoft / microsoft/vscode-cpptools

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

Open
#10,900 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

debugger more info needed
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported tasks.json and launch.json, then reproduce the F5 launch using Cygwin gcc.exe and GNU gdb 13.1 on Windows. Compare the debugger logs around -exec-run and determine whether the failure belongs to the extension or GDB; done means a confirmed cause and a more informative error or documented configuration issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.