microsoft / microsoft/vscode-cpptools

g++ debugger crashing on specific command.

Offen
#6,409 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit den bereitgestellten C++-Reproduktionen und den Konfigurationen launch.json/task.json, führe dann den Debugger aus und werte vb[0] und cv.get_a() in der Debug-Konsole aus. Untersuche das gemeldete Verhalten „GDB exited unexpectedly“ und bestätige die Erledigung, sobald diese Ausdrücke das Debugging nicht mehr abbrechen oder die Ursache eindeutig dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.