From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18197 invoked by alias); 21 Jan 2011 11:11:54 -0000 Received: (qmail 18173 invoked by uid 22791); 21 Jan 2011 11:11:54 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Jan 2011 11:11:40 +0000 From: "mjw at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug python/12425] New: Confusing python backtrace on iterator end X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjw at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 21 Jan 2011 11:11:00 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2011-q1/txt/msg00063.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=12425 Summary: Confusing python backtrace on iterator end Product: gdb Version: archer Status: NEW Severity: normal Priority: P2 Component: python AssignedTo: unassigned@sourceware.org ReportedBy: mjw@redhat.com Take the following silly example: #include #include struct foo { int a; int b; }; int main(int argc, char **argv) { std::map map; foo f = { 1, 2 }; map.insert (std::pair ("first", f)); std::map::iterator it = map.begin (); it++; return 0; } GNU gdb (GDB) Fedora (7.2-26.fc14) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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-redhat-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /tmp/foo...done. (gdb) break main Breakpoint 1 at 0x400b5d: file foo.cpp, line 12. (gdb) n The program is not being run. (gdb) r Starting program: /tmp/foo Breakpoint 1, main (argc=1, argv=0x7fffffffe278) at foo.cpp:12 12 std::map map; (gdb) n 14 foo f = { 1, 2 }; (gdb) n 15 map.insert (std::pair ("first", f)); (gdb) n 17 std::map::iterator it = map.begin (); (gdb) n 18 it++; (gdb) p it $1 = {first = "first", second = {a = 1, b = 2}} (gdb) n 20 return 0; (gdb) p it $2 = {first = Traceback (most recent call last): File "/usr/lib64/../share/gcc-4.5.1/python/libstdcxx/v6/printers.py", line 549, in to_string return self.val['_M_dataplus']['_M_p'].lazy_string (length = len) RuntimeError: Cannot access memory at address 0xffffffffffffffe9 , second = {a = -7944, b = 32767}} It isn't so much surprising that the printing fails, since we are now at it == map.end(). But you might see this sometimes when you forgot, or when taking an iterator when a map is empty so map.begin () == map.end (). It would be nice to not get that RuntimeError and partial python backtrace. It doesn't really add any information, except that the string couldn't be shown. Ideally it would detect the iterator ran out and just report that. If that isn't possible then please don't print these internal python printer errors that are just confusing and don't add any useful information. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.