public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: jian shen <vicshen@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb cannot understand some type with STL
Date: Sat, 22 Dec 2007 17:35:00 -0000	[thread overview]
Message-ID: <20071222173507.GA21728@caradoc.them.org> (raw)
In-Reply-To: <8b685e3f0712212124n64194bc7je86bede3a21c3826@mail.gmail.com>

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

  parent reply	other threads:[~2007-12-22 17:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-22  5:24 jian shen
2007-12-22 10:18 ` Eli Zaretskii
2007-12-22 10:35   ` jian shen
2007-12-22 17:35 ` Daniel Jacobowitz [this message]
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=20071222173507.GA21728@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.org \
    --cc=vicshen@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).