public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb cannot understand some type with STL
@ 2007-12-22  5:24 jian shen
  2007-12-22 10:18 ` Eli Zaretskii
  2007-12-22 17:35 ` Daniel Jacobowitz
  0 siblings, 2 replies; 11+ messages in thread
From: jian shen @ 2007-12-22  5:24 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
@ 2008-01-03 22:23 Nick Roberts
  0 siblings, 0 replies; 11+ messages in thread
From: Nick Roberts @ 2008-01-03 22:23 UTC (permalink / raw)
  To: Gordon Prieur; +Cc: Eli Zaretskii, Daniel Jacobowitz, vicshen, gdb


>     In which case "whatis 'std::list TAB" (note the single quote) should
>     complete the correct text to type, right?


> Is this solution likely to work in mi mode? I've run into similar issues with
> gdb/mi in the NetBeans gdb module.

I know nothing about NetBeans but Emacs uses the "complete" command for
completion.  Maybe NetBeans could use it too:

(gdb) 
complete whatis 'std::list<int,
&"complete whatis 'std::list<int,\n"
~"whatis 'std::list<int, std::allocator<int> >::_M_create_node(int const&)\n"
~"whatis 'std::list<int, std::allocator<int> >::_M_insert(std::_List_iterator<int>, int const&)\n"
~"whatis 'std::list<int, std::allocator<int> >::end()\n"
~"whatis 'std::list<int, std::allocator<int> >::list(std::allocator<int> const&)\n"
~"whatis 'std::list<int, std::allocator<int> >::push_back(int const&)\n"
~"whatis 'std::list<int, std::allocator<int> >::~list()\n"
~"whatis 'std::list<int,std::allocator<int> >\n"
^done
(gdb) 


or better still use:

-interpreter-exec console "complete whatis 'std::list<int,"



-- 
Nick                                           http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-01-03 22:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-22  5:24 gdb cannot understand some type with STL jian shen
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).