Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "jian shen" <vicshen@gmail.com>
To: gdb@sourceware.org
Subject: gdb cannot understand some type with STL
Date: Sat, 22 Dec 2007 05:24:00 -0000	[thread overview]
Message-ID: <8b685e3f0712212124n64194bc7je86bede3a21c3826@mail.gmail.com> (raw)

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


             reply	other threads:[~2007-12-22  5:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-22  5:24 jian shen [this message]
2007-12-22 10:18 ` Eli Zaretskii
2007-12-22 10:35   ` jian shen
2007-12-22 17:35 ` Daniel Jacobowitz
2007-12-22 17:40   ` Eli Zaretskii
2007-12-22 17:45     ` Daniel Jacobowitz
2007-12-23  2:27     ` jian shen
2008-01-02 17:29     ` Gordon Prieur
2008-01-02 18:04       ` Daniel Jacobowitz
2007-12-23  2:26   ` jian shen
2008-01-03 22:23 Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b685e3f0712212124n64194bc7je86bede3a21c3826@mail.gmail.com \
    --to=vicshen@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox