This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb cannot understand some type with STL
On Sat, Dec 22, 2007 at 01:24:16PM +0800, jian shen wrote:
> testcase 2:
>
> ----- stl.cpp -----
> #include <list>
> #include <map>
> #include <string>
>
> int main()
> {
> std::list<int> l;
> l.push_back(1);
> l.push_back(2);
>
> std::map<std::string, int> m;
> m["a1"] = 1;
> m["a2"] = 2;
> }
> ----- stl.cpp -----
>
> (gdb) whatis std::list<int>
> No symbol "list<int>" in namespace "std".
What does "whatis l" print? I believe this problem is because GDB
does not know about default template parameters.
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class list : protected _List_base<_Tp, _Alloc>
It's going to be a std::list<int, std::allocator<int> > or something
like that.
This is fixable, but it would require changes to both GCC and GDB that
no one has worked on yet.
> (gdb) whatis std::list<int>*
> A syntax error in expression, near `'.
This looks like a bug in GDB, in the c-exp.y parser.
--
Daniel Jacobowitz
CodeSourcery