microsoft / microsoft/vscode-cpptools

g++ debugger crashing on specific command.

Open
#6,409 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

the script->

#include <bits/stdc++.h>
using namespace std;
vector<int> vb;
int main() {
    vb.push_back(9);
    cout<<vb[0];
    return 0;
}

breakpoint at line 7

output->9 as expected.

but when i write-->"vb[0]" on debug console the whole thing crush with error-->

 ERROR: GDB exited unexpectedly. Debugging will now abort.
The program 'c:\Users\Belayet Hossain\Documents\vs code project\other\other.exe' has exited with code -1 (0xffffffff).

my launch.json:
{

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}

and task.json:

{
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ],
    "version": "2.0.0"
}

same thing happen when
script-->

#include <bits/stdc++.h>
using namespace std;
struct other
{
    int a,s,d;
    int get_a(){
        return a;
    }
};
int main() {
    struct other cv={1,2,3};
    cout<<cv.get_a();
    return 0;
}

and on debug console calling
cv.get_a()

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 provided C++ reproductions and the launch.json/task.json configurations, then run the debugger and evaluate vb[0] and cv.get_a() in the debug console. Investigate the reported “GDB exited unexpectedly” behavior and confirm done when these expressions no longer abort debugging or the cause is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.