Vscode-cpptools: pretty-printing not working with MinGW GDB

Created on 12 Jul 2019  Â·  7Comments  Â·  Source: microsoft/vscode-cpptools

Same problem! Vectors doesn't show its elements.
I'm currently using this task file:

"version": "2.0.0",
"tasks": [
    {
        "label": "echo",
        "type": "shell",
        "command": "g++",
        "args": [
            "-g", "${relativeFile}", "-o", "example"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]

}

and this launch file:

{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/example.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\MinGW\bin\gdb.exe",
"preLaunchTask": "echo",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

Has anybody found any solution for MinGW (windows 10)? Enabling pretty printing didn't help.
Thanks!

_Originally posted by @tomas-silveira in https://github.com/microsoft/vscode-cpptools/issues/1768#issuecomment-507073918_

debugger investigate

Most helpful comment

@tdjastrzebski Would you be able to run info pretty-printer in your version of gdb and see if any pretty printers exist for the type you want? That command should show all the pretty printers in that version of gdb. I suspect that it is missing files.

@pieandcakes
Mingw has 3 gdbinit files. Like shown:
image

Two of them is missing register_libstdcxx_printers (None) line.
Add a register line to all of them, and thats it.
Now for gdb info pretty-printing:
image

All 7 comments

Same problem here: no string values in debugger/variables window.
OS: Windows 10, VS Code 1.36, g++ 8.2.0, gdb 7.6.1
I got just MinGW from https://osdn.net/projects/mingw/
Should I try another distro with more recent versions, switch to a different OS or abandon any hope for now?

_Originally posted by @tdjastrzebski in https://github.com/microsoft/vscode-cpptools/issues/1768#issuecomment-510677351_

@tdjastrzebski Do you see a difference in how it is visualized if you remove the pretty-printer line in your launch.json ?

To add to that, it looks like MinGW ships a separate gdb that has Python enabled as Python is what does the pretty-printing. You may need to point your miDebuggerPath to that. Online searches tells me it should be in the same folder as gdb but called something like gdb-python27.exe.

_Originally posted by @pieandcakes in https://github.com/microsoft/vscode-cpptools/issues/1768#issuecomment-510680506_

@pieandcakes Thank you for your help. There is no apparent difference after removing pretty-printer.
This particular MinGW distribution I installed does not contain any other gdb*, besides gdbserver.exe.
The other two distributions I found:
https://sourceforge.net/projects/mingw-w64/
https://mingw-w64.org/doku.php/download
do not install at all or are very difficult to configure - at best.
Please advise.

vs code gdb 1

_Originally posted by @tdjastrzebski in https://github.com/microsoft/vscode-cpptools/issues/1768#issuecomment-510774779_

@pieandcakes Note I did not try the latest MinGW version.
g++ was ver 8.2.0, gdb 7.6.1

@tdjastrzebski Would you be able to run info pretty-printer in your version of gdb and see if any pretty printers exist for the type you want? That command should show all the pretty printers in that version of gdb. I suspect that it is missing files.

@tdjastrzebski Would you be able to run info pretty-printer in your version of gdb and see if any pretty printers exist for the type you want? That command should show all the pretty printers in that version of gdb. I suspect that it is missing files.

@pieandcakes
Mingw has 3 gdbinit files. Like shown:
image

Two of them is missing register_libstdcxx_printers (None) line.
Add a register line to all of them, and thats it.
Now for gdb info pretty-printing:
image

This issue has been closed automatically because it has not had recent activity.

Was this page helpful?
0 / 5 - 0 ratings