scarlett
scarlett

Reputation: 23

vscode gdb debugger not showing qt variables c++

I want to use VSCode to write Qt projects, since the Qt Creator is really hard to use.

But the debugger in VSCode just can't show the real value of Qt variables which is really upset.

I have this configuration in launch.json:

"configurations": [
        {
            "name": "gdb-Debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/path/to/exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Qt\\Tools\\mingw730_64\\bin\\gdb.exe",
            "visualizerFile": "${workspaceFolder}/.vscode/qt5.natvis",
            "showDisplayString": true,
            "setupCommands": [
                {
                    "description": "Enable pretty printing",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "make-debug-all"
        }
    

And I have download the natvis file from here: https://github.com/qt-labs/vstools/blob/dev/QtMSBuild/QtMsBuild/qt5.natvis.xml.

And I use mingw not msvc to compile the project.

But when use the debugger it still not showing the exact value of the Qt variables, like QString.

It just show some really wired thing. enter image description here

Seems like it just show the address, and I can't see the real value stores in it. Even qDebug() won't print the right value.

I don't know what else to do or which step I'm wrong? Can someone help me out?

Upvotes: 0

Views: 88

Answers (0)

Related Questions