c++ stl - manually using standard gdb pretty printers
15:58 17 Aug 2018

How can i use StdVectorPrinter of https://github.com/gcc-mirror/gcc/blob/gcc-6_3_0-release/libstdc%2B%2B-v3/python/libstdcxx/v6/printers.py to create my own output style?
I.e. use the existing tools for element access, but drive the output on my own.

E.g. for

#include 
#include 
#include 

int main(int, char**)
{
    std::vector data = { "hello", "world", "all", "is", "fine" };

    for ( auto && i : data) {
        std::cout << i << std::endl;
    }
    return 0;
}

The output shall not be

(gdb) p data
$2 = std::vector of length 5, capacity 5 = {"hello", "world", "all", "is", "fine"}

But

(gdb) p data
$2 = "hello|world|all|is|fine"

Where is the skeleton code for the generic printer, that uses the StdVectorPrinter (e.g.)?

python c++ stl gdb