Taken from the default gdb's libstdcxx
pretty printers, with some modifications.
- Implement end-iterator detection for
StdDebugIteratorPrinter
- Better output for std::bitset / std::set (default:
[0]: 1,[1]: 2
, improved:{1, 2}
, like an array) - Remove some
__debug
from output, in debug compilation (for examplestd::__debug::vector
→std::vector
) - Add
std::array
printer (the default one shows the internal member name_M_elems
in the output) - Hide capacity data for vector
Follow the instruction in c++ - How to pretty-print STL containers in GDB? - Stack Overflow.
Change sys.path
to point to the correct location.
The original ones can be found somewhere in /usr/share/gcc-11.1.0/python/libstdcxx/
(specific path depends on distribution).
Also see gdb source code.