microsoft / microsoft/vscode-cpptools
Cannot view contents of a map.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Type: Debugger
Can't view the contents. Im on Ubuntu 20.04. Whenever I try to open the map of vectors debugger crashes with
NullReferenceException: Object reference not set to an instance of an object
I have tried reinstalling gdb - multiple versions, VSCode - insiders and not insiders.
this is my launch.json
`
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [
"<",
"test"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
],
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
},
"preLaunchTask": "C/C++: g++ build active file",
"miDebuggerPath": "/usr/local/bin/gdb"
}
]
}
`
in GUI it loads forever.

logs show this
<-- C (variables-18): {"command":"variables","arguments":{"variablesReference":1004},"type":"request","seq":18}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (14333) <-1054-var-list-children --simple-values \"var15\" 0 1000\n"},"seq":714}
1: (14333) <-1054-var-list-children --simple-values "var15" 0 1000
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (14334) ->1054^done,numchild=\"2\",displayhint=\"map\",children=[child={name=\"var15.[0]\",exp=\"[0]\",numchild=\"1\",value=\"0x55555557f710\",type=\"Node * const\",thread-id=\"1\"},child={name=\"var15.[1]\",exp=\"[1]\",numchild=\"0\",value=\"{...}\",type=\"std::vector<Node*, std::allocator<Node*> >\",thread-id=\"1\",displayhint=\"array\",dynamic=\"1\"}],has_more=\"0\"\n"},"seq":716}
1: (14334) ->1054^done,numchild="2",displayhint="map",children=[child={name="var15.[0]",exp="[0]",numchild="1",value="0x55555557f710",type="Node * const",thread-id="1"},child={name="var15.[1]",exp="[1]",numchild="0",value="{...}",type="std::vector<Node*, std::allocator<Node*> >",thread-id="1",displayhint="array",dynamic="1"}],has_more="0"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (14334) ->(gdb)\n"},"seq":718}
1: (14334) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (14334) 1054: elapsed time 1\n"},"seq":720}
1: (14334) 1054: elapsed time 1
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
map of that type
unordered_map<Node *, vector<Node *>> test;
when key is changed to int type - the problem is goes away.
same issue with unordered_set, set, map. Vector works fine for example.
Also when i leave the body of Node struct empty - the problem goes away.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der launch.json-Konfiguration und der protokollierten var-list-children-Anfrage für var15. Reproduziere den Fehler mit unordered_map<Node*, vector<Node*>>, und vergleiche ihn anschließend mit vector, skalaren Schlüsseln und einem leeren Node-Body. Als abgeschlossen gilt die Aufgabe, wenn diese Containerwerte im Debugger ohne NullReferenceException oder endloses Laden dargestellt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, ubuntu, vscode
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100