* 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
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
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2007-12-22 10:18 UTC (permalink / raw)
To: jian shen; +Cc: gdb
> Date: Sat, 22 Dec 2007 13:24:16 +0800
> From: "jian shen" <vicshen@gmail.com>
>
> (gdb) whatis std::list<int>
> No symbol "list<int>" in namespace "std".
Does it work to quote the argument of whatis? Like this:
(gdb) whatis 'std::list<int>'
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
2007-12-22 10:18 ` Eli Zaretskii
@ 2007-12-22 10:35 ` jian shen
0 siblings, 0 replies; 11+ messages in thread
From: jian shen @ 2007-12-22 10:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
It doesn't work, but the error message is a little different.
(gdb) whatis std::list<int>
No symbol "list<int>" in namespace "std".
(gdb) whatis 'std::list<int>'
No symbol "std::list<int>" in current context.
On 12/22/07, Eli Zaretskii <eliz@gnu.org> wrote:
>
> Does it work to quote the argument of whatis? Like this:
>
> (gdb) whatis 'std::list<int>'
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
2007-12-22 5:24 gdb cannot understand some type with STL jian shen
2007-12-22 10:18 ` Eli Zaretskii
@ 2007-12-22 17:35 ` Daniel Jacobowitz
2007-12-22 17:40 ` Eli Zaretskii
2007-12-23 2:26 ` jian shen
1 sibling, 2 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2007-12-22 17:35 UTC (permalink / raw)
To: jian shen; +Cc: gdb
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
2007-12-22 17:35 ` Daniel Jacobowitz
@ 2007-12-22 17:40 ` Eli Zaretskii
2007-12-22 17:45 ` Daniel Jacobowitz
` (2 more replies)
2007-12-23 2:26 ` jian shen
1 sibling, 3 replies; 11+ messages in thread
From: Eli Zaretskii @ 2007-12-22 17:40 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: vicshen, gdb
> Date: Sat, 22 Dec 2007 12:35:07 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb@sourceware.org
>
> It's going to be a std::list<int, std::allocator<int> > or something
> like that.
In which case "whatis 'std::list TAB" (note the single quote) should
complete the correct text to type, right?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
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
2 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2007-12-22 17:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: vicshen, gdb
On Sat, Dec 22, 2007 at 07:40:31PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 22 Dec 2007 12:35:07 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: gdb@sourceware.org
> >
> > It's going to be a std::list<int, std::allocator<int> > or something
> > like that.
>
> In which case "whatis 'std::list TAB" (note the single quote) should
> complete the correct text to type, right?
I think so.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
2007-12-22 17:35 ` Daniel Jacobowitz
2007-12-22 17:40 ` Eli Zaretskii
@ 2007-12-23 2:26 ` jian shen
1 sibling, 0 replies; 11+ messages in thread
From: jian shen @ 2007-12-23 2:26 UTC (permalink / raw)
To: jian shen, gdb
On 12/23/07, Daniel Jacobowitz <drow@false.org> wrote:
> 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.
You are right.
(gdb) whatis l
type = std::list<int, std::allocator<int> >
(gdb) whatis 'std::list<int, std::allocator<int> >'
type = std::list<int, std::allocator<int> >
>
> 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.
Yes, this looks like a bug.
(gdb) whatis 'std::list<int, std::allocator<int> >*'
No symbol "std::list<int, std::allocator<int> >*" in current context.
Thanks,
Jian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
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
2 siblings, 0 replies; 11+ messages in thread
From: jian shen @ 2007-12-23 2:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Daniel Jacobowitz, gdb
On 12/23/07, Eli Zaretskii <eliz@gnu.org> wrote:
> In which case "whatis 'std::list TAB" (note the single quote) should
> complete the correct text to type, right?
>
I confirmed this and you are right.
Thanks,
Jian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
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
2 siblings, 1 reply; 11+ messages in thread
From: Gordon Prieur @ 2008-01-02 17:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Daniel Jacobowitz, vicshen, gdb
Eli Zaretskii wrote:
>> Date: Sat, 22 Dec 2007 12:35:07 -0500
>> From: Daniel Jacobowitz <drow@false.org>
>> Cc: gdb@sourceware.org
>>
>> It's going to be a std::list<int, std::allocator<int> > or something
>> like that.
>>
>
> 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.
Gordon
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: gdb cannot understand some type with STL
2008-01-02 17:29 ` Gordon Prieur
@ 2008-01-02 18:04 ` Daniel Jacobowitz
0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-01-02 18:04 UTC (permalink / raw)
To: Gordon Prieur; +Cc: Eli Zaretskii, vicshen, gdb
On Wed, Jan 02, 2008 at 09:22:56AM -0800, Gordon Prieur wrote:
> Is this solution likely to work in mi mode? I've run into similar issues
> with gdb/mi
> in the NetBeans gdb module.
No, I'm not sure how to handle this in MI.
--
Daniel Jacobowitz
CodeSourcery
^ 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).