4

When I use vscode, the pretty-printer for gdb seems quite different from lldb. The lldb on MacOs will show some field details and the size of containers directly which will be helpful when I debug.

gdb pretty-print on linux
gdb pretty-print on linux

lldb on MacOS
lldb on MacOS

So how can I achieve a similar effect with gdb on linux?

I set my gdb pretty-printer by following How to enable gdb pretty printing for C++ STL objects in Eclipse CDT?

And I set my launch.json on Vscode like this

"configurations": [
{
    "name": "C++ Launch",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/a.out",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}/include/",
    "environment": [],
    "externalConsole": false,
    "setupCommands": [
        { 
            "text": "-enable-pretty-printing",
            "description": "enable pretty printing", 
            "ignoreFailures": true 
        }
    ]
}]

0 Answers0