public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/45403]  New: broken python pretty printer for unordered_map.
@ 2010-08-25 13:28 pluto at agmk dot net
  2010-08-25 14:12 ` [Bug libstdc++/45403] " redi at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: pluto at agmk dot net @ 2010-08-25 13:28 UTC (permalink / raw)
  To: gcc-bugs

#include <unordered_map>
#include <string>
int main()
{
std::unordered_map< int, std::string > ht;
ht[ 42 ] = "foo";
}

Breakpoint 1, main () at t.cpp:5
(gdb) n
(gdb) p ht
$1 = std::unordered_map with 0 elements
(gdb) n
(gdb) p ht
$2 = std::unordered_map with 1 elements = {
  [42] = Traceback (most recent call last):
  File
"/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/share/gcc-4.5.2/python/libstdcxx/v6/printers.py",
line 549, in to_string
    return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
AttributeError: 'gdb.Value' object has no attribute 'lazy_string'


-- 
           Summary: broken python pretty printer for unordered_map.
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: x86_64-gnu-linux
  GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] broken python pretty printer for unordered_map.
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
@ 2010-08-25 14:12 ` redi at gcc dot gnu dot org
  2010-08-25 14:17 ` [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1 redi at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-08-25 14:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2010-08-25 14:12 -------
It's nothing to do with unordered_map, it's std::string, and it fails because
lazy_string was added in GDB 7.1

we can probably do something like

        if (gdb.VERSION == '7.0'):
            return '"' + self.val['_M_dataplus']['_M_p'].string (length = len)
+ '"'
        return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
  2010-08-25 14:12 ` [Bug libstdc++/45403] " redi at gcc dot gnu dot org
@ 2010-08-25 14:17 ` redi at gcc dot gnu dot org
  2010-09-14 12:04 ` pluto at agmk dot net
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-08-25 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from redi at gcc dot gnu dot org  2010-08-25 14:17 -------
Tom, I don't remember if the decision to use lazy_string (and therefore require
GDB 7.1) was intentional - is a fallback worthwhile?


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
            Summary|broken python pretty printer|python pretty printer for
                   |for unordered_map.          |std::string requires GDB 7.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
  2010-08-25 14:12 ` [Bug libstdc++/45403] " redi at gcc dot gnu dot org
  2010-08-25 14:17 ` [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1 redi at gcc dot gnu dot org
@ 2010-09-14 12:04 ` pluto at agmk dot net
  2010-09-14 12:47 ` redi at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: pluto at agmk dot net @ 2010-09-14 12:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pluto at agmk dot net  2010-09-14 12:04 -------
(In reply to comment #1)
> It's nothing to do with unordered_map, it's std::string, and it fails because
> lazy_string was added in GDB 7.1
> 
> we can probably do something like
> 
>         if (gdb.VERSION == '7.0'):
>             return '"' + self.val['_M_dataplus']['_M_p'].string (length = len)
> + '"'
>         return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)

this change isn't perfect because the gdb.VERSION may be decorated
with vendor strings. can we get something like this in lbistdc++:

-        return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
+        if hasattr(self.val['_M_dataplus']['_M_p'], "lazy_string"):
+            return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
+        return self.val['_M_dataplus']['_M_p'].string (length = len)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (2 preceding siblings ...)
  2010-09-14 12:04 ` pluto at agmk dot net
@ 2010-09-14 12:47 ` redi at gcc dot gnu dot org
  2010-09-15  7:52 ` pluto at agmk dot net
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-09-14 12:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from redi at gcc dot gnu dot org  2010-09-14 12:47 -------
looks sensible, I'll do that


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |redi at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-14 12:47:11
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (3 preceding siblings ...)
  2010-09-14 12:47 ` redi at gcc dot gnu dot org
@ 2010-09-15  7:52 ` pluto at agmk dot net
  2010-09-15 11:21 ` redi at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: pluto at agmk dot net @ 2010-09-15  7:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pluto at agmk dot net  2010-09-15 07:52 -------
there's one more issue with std::string pretty printing.
with -gdwarf-4 enabled it fails on gdb-7.2 with runtime error:

$1 = Traceback (most recent call last):
  File
"/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/share/gcc-4.5.2/python/libstdcxx/v6/printers.py",
line 546, in to_string
    reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
RuntimeError: No type named std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep.

for -gdwarf-2 and -gdwarf-3 it works.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (4 preceding siblings ...)
  2010-09-15  7:52 ` pluto at agmk dot net
@ 2010-09-15 11:21 ` redi at gcc dot gnu dot org
  2010-09-15 11:34 ` pluto at agmk dot net
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-09-15 11:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from redi at gcc dot gnu dot org  2010-09-15 11:21 -------
(In reply to comment #5)
> with -gdwarf-4 enabled it fails on gdb-7.2 with runtime error:

I couldn't reproduce that with 4.5.2 20100909, can you give more details?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (5 preceding siblings ...)
  2010-09-15 11:21 ` redi at gcc dot gnu dot org
@ 2010-09-15 11:34 ` pluto at agmk dot net
  2010-09-15 23:43 ` redi at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: pluto at agmk dot net @ 2010-09-15 11:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pluto at agmk dot net  2010-09-15 11:34 -------
(In reply to comment #6)
> (In reply to comment #5)
> > with -gdwarf-4 enabled it fails on gdb-7.2 with runtime error:
> 
> I couldn't reproduce that with 4.5.2 20100909, can you give more details?

$ cat t.cpp 
#include <string>
int main()
{
        std::string s( "foo" );
        s.size();
}

$ /local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/bin/x86_64-gnu-linux-g++
t.cpp -gdwarf-4 -g2 -o t                     

$ gdb ./t
(gdb) b main
Breakpoint 1 at 0x402c8d: file t.cpp, line 4.
(gdb) r
Starting program: /home/users/pawels/sandbox/src/bug/t 
Breakpoint 1, main () at t.cpp:4
4               std::string s( "foo" );
(gdb) n
5               s.size();
(gdb) p s
$1 = Traceback (most recent call last):
  File
"/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/share/gcc-4.5.2/python/libstdcxx/v6/printers.py",
line 546, in to_string
    reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
RuntimeError: No type named std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (6 preceding siblings ...)
  2010-09-15 11:34 ` pluto at agmk dot net
@ 2010-09-15 23:43 ` redi at gcc dot gnu dot org
  2010-09-15 23:52 ` redi at gcc dot gnu dot org
  2010-09-16 14:05 ` pluto at agmk dot net
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-09-15 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from redi at gcc dot gnu dot org  2010-09-15 23:43 -------
Hmm, OK, I can reproduce that with a current 4.5.2 build, but not with a
snapshot from last week. Please file a separate bug for that, component=c++ -
thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (7 preceding siblings ...)
  2010-09-15 23:43 ` redi at gcc dot gnu dot org
@ 2010-09-15 23:52 ` redi at gcc dot gnu dot org
  2010-09-16 14:05 ` pluto at agmk dot net
  9 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-09-15 23:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from redi at gcc dot gnu dot org  2010-09-15 23:52 -------
oops, I wasn't paying attention - I screwed up my build of gdb-7.2 so it didn't
have python support and mistook the non-pretty printed string for a traceback!

Here is a fresh GCC 4.5.2 build and a vanilla GDB 7.2 build (with python
support!)

moria:shm$ cat pr45403.cc 
#include <string>
int main()
{
        std::string s( "foo" );
        s.size();
}
moria:shm$ ~/gcc/4.5/bin/g++ pr45403.cc -v 2>&1 | fgrep 'version 4.5'
gcc version 4.5.2 20100915 (prerelease) (GCC) 
GNU C++ (GCC) version 4.5.2 20100915 (prerelease) (x86_64-unknown-linux-gnu)
GNU C++ (GCC) version 4.5.2 20100915 (prerelease) (x86_64-unknown-linux-gnu)
moria:shm$ 
moria:shm$ ~/gcc/4.5/bin/g++ pr45403.cc -gdwarf-4 -g2 -Wl,-R$HOME/gcc/4.5/lib64
moria:shm$ 
moria:shm$ /dev/shm/gdb/bin/gdb ./a.out
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /dev/shm/a.out...done.
(gdb) br main
Breakpoint 1 at 0x4007cd: file pr45403.cc, line 4.
(gdb) r
Starting program: /dev/shm/a.out 

Breakpoint 1, main () at pr45403.cc:4
4               std::string s( "foo" );
(gdb) n
5               s.size();
(gdb) p s
$1 = "foo"

Are you sure you haven't modified your GCC sources?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
  2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
                   ` (8 preceding siblings ...)
  2010-09-15 23:52 ` redi at gcc dot gnu dot org
@ 2010-09-16 14:05 ` pluto at agmk dot net
  9 siblings, 0 replies; 15+ messages in thread
From: pluto at agmk dot net @ 2010-09-16 14:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pluto at agmk dot net  2010-09-16 14:04 -------
(In reply to comment #9)

> Are you sure you haven't modified your GCC sources?

i'm testing gcc-4.5 from svn branch, with gdb-7.2 and binutils-2.20.51.0.11.
filled as PR45690.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
       [not found] <bug-45403-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-10-08 12:04 ` redi at gcc dot gnu.org
@ 2010-10-08 12:09 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-08 12:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.6.0                       |4.5.2

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 12:08:44 UTC ---
I've tested it myself and have fixed it for 4.5.2 as well


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
       [not found] <bug-45403-4@http.gcc.gnu.org/bugzilla/>
  2010-10-08 11:32 ` redi at gcc dot gnu.org
  2010-10-08 11:40 ` redi at gcc dot gnu.org
@ 2010-10-08 12:04 ` redi at gcc dot gnu.org
  2010-10-08 12:09 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-08 12:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 12:04:21 UTC ---
Author: redi
Date: Fri Oct  8 12:04:14 2010
New Revision: 165164

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165164
Log:
    PR libstdc++/45403
    * python/libstdcxx/v6/printers.py: Check for lazy_string support.

Modified:
    branches/gcc-4_5-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_5-branch/libstdc++-v3/python/libstdcxx/v6/printers.py


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
       [not found] <bug-45403-4@http.gcc.gnu.org/bugzilla/>
  2010-10-08 11:32 ` redi at gcc dot gnu.org
@ 2010-10-08 11:40 ` redi at gcc dot gnu.org
  2010-10-08 12:04 ` redi at gcc dot gnu.org
  2010-10-08 12:09 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-08 11:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 11:40:04 UTC ---
Fixed for 4.6.0

Pawel, can you test with an older GDB? I no longer have 7.0 around.
If it works fine I will apply it to the 4.5 branch as well, it isn't a
regression but I think it should be safe to do on the release branch.


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

* [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1
       [not found] <bug-45403-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-08 11:32 ` redi at gcc dot gnu.org
  2010-10-08 11:40 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-08 11:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45403

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 11:32:00 UTC ---
Author: redi
Date: Fri Oct  8 11:31:56 2010
New Revision: 165163

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165163
Log:
    PR libstdc++/45403
    * python/libstdcxx/v6/printers.py: Check for lazy_string support.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/python/libstdcxx/v6/printers.py


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

end of thread, other threads:[~2010-10-08 12:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-25 13:28 [Bug libstdc++/45403] New: broken python pretty printer for unordered_map pluto at agmk dot net
2010-08-25 14:12 ` [Bug libstdc++/45403] " redi at gcc dot gnu dot org
2010-08-25 14:17 ` [Bug libstdc++/45403] python pretty printer for std::string requires GDB 7.1 redi at gcc dot gnu dot org
2010-09-14 12:04 ` pluto at agmk dot net
2010-09-14 12:47 ` redi at gcc dot gnu dot org
2010-09-15  7:52 ` pluto at agmk dot net
2010-09-15 11:21 ` redi at gcc dot gnu dot org
2010-09-15 11:34 ` pluto at agmk dot net
2010-09-15 23:43 ` redi at gcc dot gnu dot org
2010-09-15 23:52 ` redi at gcc dot gnu dot org
2010-09-16 14:05 ` pluto at agmk dot net
     [not found] <bug-45403-4@http.gcc.gnu.org/bugzilla/>
2010-10-08 11:32 ` redi at gcc dot gnu.org
2010-10-08 11:40 ` redi at gcc dot gnu.org
2010-10-08 12:04 ` redi at gcc dot gnu.org
2010-10-08 12:09 ` redi at gcc dot gnu.org

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).