Vector of vectors is currently displayed as: (gdb) p test $1 = std::vector of length 2, capacity 2 = {std::vector of length 2, capacity 2 = {0, 1}, std::vector of length 2, capacity 2 = {2, 3}} while user suggested something like: (gdb) p test $1 = std::vector of length 2, capacity 2 = {std::vector of length 2, capacity 2 = {0, 1}, std::vector of length 2, capacity 2 = {2, 3}} matrix contents = 0 2 1 3 Testcase: #include <vector> #include <iostream> int main(){ std::vector< std::vector<int> > test(2, std::vector<int>(2,0)); test[0][0]=0; test[0][1]=1; test[1][0]=2; test[1][1]=3; int a=test[1][0]; std::cout << a; }
One way might be a new 'display_hint' that is some kind of structured value, e.g. a tuple like ("matrix", 20, 10)
I don't know if it makes sense to try to apply this to vector<vector> but now there is also std::mdspan: https://en.cppreference.com/w/cpp/container/mdspan ... and anyway gdb should provide the basic facility.