microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

Add default Natvis for GCC STL #10993

Open yh-sb opened 1 year ago

yh-sb commented 1 year ago

Feature Request

As you know, cppvsdbg has default Natvis for STL unlike cppdbg GCC. I would like to suggest adding a default visualizer for GCC STL in case when "visualizerFile" isn't set in launch.json.

Here is my Natvis file for GCC STL (I tested it with GCC 12 and 13): https://gist.github.com/yhsb2k/5c56887cd6d8f06f54846fa11c613748

WardenGnaw commented 1 year ago

Ideally, GDB's pretty printer would handle visualizing standard library objects. Are there objects that are not being properly handled by GDB's pretty printer?

yh-sb commented 1 year ago

GDB's (GCC 12, 13) pretty printer is really printing its STL objects correctly. Source code:

std::vector<int> vect = {2, 1, 3, 20};

GDB terminal:

print vect
$1 = std::vector of length 4, capacity 4 = {2, 1, 3, 20}

But vscode doesn't use this.