microsoft / microsoft/vscode-cpptools

GDB exit when viewing the registers

Open
#12,137 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment
  • OS and version: Windows 11
  • VS Code: 1. 87. 2
  • C/C++ extension: 1. 3. 0
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: GDB 8. 1
Bug Summary and Steps to Reproduce

When using gdb to debug C program (It happened to each of my C programs), every time I click the "registers" button on the left to view registers or I execute "-exec info registers" in the debug console, the debugger would exit unexpectedly.

Debugger Configurations
tasks.json:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "make",
            // "args": ["default"],
            "type": "shell"
        },
        {
            "label": "build-debug",
            "command": "make",
            "args": ["debug"],
            "type": "shell"
        },
        {   
            "label": "clean",
            "command": "make",
            "args": ["clean"],
            "type": "shell"
        }
    ]
}


-------------------------------------------------

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(gdb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/bin/philosipher",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": false
        }
      ],
      "preLaunchTask": "build"
    },
  ],
  "logging": {
    "engineLogging": true,
    "traceResponse": true
  }
}
Debugger Logs
I have added "logging": { "engineLogging": true, "trace": true, "traceResponse": true }

However, the debugger logs in "Debug Console" didn't change:
(I suspected that it was because I did not configure "logging" properly, if so, inform me please!)

Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
-exec info registers
ERROR: GDB exited unexpectedly. Debugging will now abort.
The program 'D:\Code\NJU_OS\demos/bin/philosipher' has exited with code -1 (0xffffffff).
Other Extensions

I do not rely on any other extensions to debug C in VScode.

Additional Information

I noticed that there was a similar issue last year, but not been solved yet.
So I issued on my own and hope that it can get solved.
Sorry for the duplication!

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

Reproduce on Windows 11 with VS Code 1.87.2, C/C++ extension 1.3.0, and GDB 8.1 using the provided launch.json and tasks.json. Start with the Registers view and the “-exec info registers” command, then inspect the debugger logs and GDB interaction. Done means viewing registers no longer exits GDB and the failure is covered by a verified regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.