microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

g++ debugger crashing on specific command. #6409

Open irfan-hossain-bhuiyan opened 3 years ago

irfan-hossain-bhuiyan commented 3 years ago

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()

WardenGnaw commented 3 years ago

Thank you for reporting this issue. We’ll let you know if we need more information to investigate it

irfan-hossain-bhuiyan commented 3 years ago

I want to know is this problem is occuring only in my computer or it is a bug.