It seems that for several STL containers, GDB omitts printing its template parameters. For example
(gdb) whatis a
type = std::vector<int>
And it causes problems for me.
(gdb) whatis std::vector<int>::_M_impl
No type "vector<int>" within class or namespace "std".
(gdb) p *reinterpret_cast<std::vector<int>*>(0x7fffffffd920)
A syntax error in expression, near `*>(0x7fffffffd920)'.
To get what I want, I have to manually add the not shown template parameters.
(gdb) whatis std::vector<int, std::allocator<int> >::_M_impl
type = std::_Vector_base<int, std::allocator<int> >::_Vector_impl
(gdb) p *reinterpret_cast<std::vector<int, std::allocator<int> >*>(0x7fffffffd920)
$5 = ......
However, this isn't ideal since it is hard to generic program adding these omitted template parameters. For example, given std::map<int, double>, how can I know there are extra template parameters Compare and Allocator, thus able to get std::less<Key> and std::allocator<std::pair<const Key, T> >
Is there a way for GDB to print type without omitting template parameters? Or is there another way around my problem?