Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

c++ - GDB crashes with NullReferenceException on map opening

Can't view the contents. Im on Ubuntu 20.04. Whenever I try to open the map of vectors debugger crashes with enter image description here

and keeps loading forever enter image description here

enter image description here this is my map. Node * has no overridden hash method and actually is pretty basic

struct Node{
const int id;
Node * sccRepresentant = nullptr;
int size = 1;//used in sccGraph
vector<Node *> outConnections;
vector<Node *> inConnections;

vector<Node *> sccOutConnections; //if node is scc - these are connections to other sccs
vector<Node *> sccInConnections; //if node is scc - these are connections to other sccs
Node(int id):id(id){}

};

The issue is gone when I change the key from Node * to int

Also I noticed - this happens when pretty printing is enabled enter image description here

IDE - visual studio code Insiders using this extension enter image description here

I tried reinstalling gdb

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++ - 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": true
            }
        ],
        "preLaunchTask": "C/C++: g++ build active file",
        "miDebuggerPath": "/usr/bin/gdb"
    }
]

} tasks.json

{
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++ build active file",
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "options": {
            "cwd": "${workspaceFolder}"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Task generated by Debugger."
    }
],
"version": "2.0.0"

}

this is the log i get

enter image description here

question from:https://stackoverflow.com/questions/65870377/gdb-crashes-with-nullreferenceexception-on-map-opening

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...