2

I am trying to figure out why pretty printing won't function correctly. I've looked in a number of places to try and figure out why it won't work, but I haven't found a solution yet.

Here is the problem:

vscode screenshot

As you can see, the vector state doesn't show its elements. Here is my launch.json:

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

Here is my tasks.json:

{
    "tasks": [
        {
            "type": "shell",
            "label": "build",
            "command": "C:\\MinGW\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\MinGW\\bin"
            }
        }
    ],
    "version": "2.0.0"
}
ElohmroW
  • 77
  • 1
  • 10

1 Answers1

1

I got it to work. Here is the post that saved me:

How to enable gdb pretty printing for C++ STL objects in Eclipse CDT?

I followed the instructions labeled:

This is for MinGW users with Eclipse CDT

I put the .gdbinit inside my cpp projects folder root for reference.

ElohmroW
  • 77
  • 1
  • 10