This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
gdb cannot understand some type with STL
- From: "jian shen" <vicshen at gmail dot com>
- To: gdb at sourceware dot org
- Date: Sat, 22 Dec 2007 13:24:16 +0800
- Subject: gdb cannot understand some type with STL
Hi
gdb version: 6.6
gcc version: 3.3.6
qt version: 3.1
Everything is correct when I use qt container:
testcase 1:
----- qt.cpp -----
#include <qstring.h>
#include <qmap.h>
#include <qvaluelist.h>
int main()
{
QValueList<int> l;
l.push_back(1);
l.push_back(2);
QMap<QString, int> m;
m["a1"] = 1;
m["a2"] = 2;
}
----- qt.cpp -----
(gdb) whatis QValueList<int>
type = QValueList<int>
(gdb) whatis QValueList<int>*
type = QValueList<int> *
(gdb) whatis QValueListNode<int>
type = QValueListNode<int>
(gdb) whatis QValueListNode<int>*
type = QValueListNode<int> *
(gdb) whatis QMap<QString, int>
type = QMap<QString, int>
(gdb) whatis QMap<QString, int>*
type = QMap<QString, int> *
(gdb) whatis QMapNode<QString, int>
type = QMapNode<QString, int>
(gdb) whatis QMapNode<QString, int>*
type = QMapNode<QString, int> *
but some problems in stl container:
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".
(gdb) whatis std::list<int>*
A syntax error in expression, near `'.
(gdb) whatis std::_List_node<int>
type = std::_List_node<int>
(gdb) whatis std::_List_node<int>*
A syntax error in expression, near `'.
(gdb) whatis std::map<std::string, int>
No symbol "map<std::string, int>" in namespace "std".
(gdb) whatis std::map<std::string, int>*
A syntax error in expression, near `'.
(gdb) whatis std::_Rb_tree_node<std::pair<std::string const, int> >
type = std::_Rb_tree_node<std::pair<std::string const, int> >
(gdb) whatis std::_Rb_tree_node<std::pair<std::string const, int> > *
A syntax error in expression, near `'.
Most of the type become unidentifiable, which makes me difficult to
write a gdb script, for example, with qt, I can:
(gdb) set $a=(QValueListNode<int>*)0
(gdb) p $a
$1 = (QValueListNode<int> *) 0x0
but with stl:
(gdb) set $a=(std::_List_node<int>*)0
A syntax error in expression, near `)0'.
Is this a bug in gdb or gcc? Any other choice I can try for this problem?
Thanks,
Jian