public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "jwakely.gcc at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/28480] pretty printing getting confused Date: Thu, 04 Nov 2021 17:36:31 +0000 [thread overview] Message-ID: <bug-28480-4717-yo1ZwXWCvW@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-28480-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=28480 Jonathan Wakely <jwakely.gcc at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=103086 --- Comment #11 from Jonathan Wakely <jwakely.gcc at gmail dot com> --- I've created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103086 for this, with a more detailed explanation. I think GDB's new behaviour is probably better, and the libstdc++ printers should be fixed. However, Bruno did suggest that when tuple_member['_M_head_impl'] is ambiguous it should give an error, not silently return either the first or last matching member. For example, in this code: struct X { int i = 0x1; }; struct Y { char i = 'Y'; }; struct Z : X, Y { }; int main() { Z z; return 0; } GDB 10 will happily print z.i $ gdb -ex start -ex n -ex "py print(gdb.parse_and_eval('z')['i'])" a.out GNU gdb (GDB) Fedora 10.2-3.fc34 Copyright (C) 2021 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-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.out... Temporary breakpoint 1 at 0x40110a: file ambig.cc, line 15. Starting program: /tmp/a.out Temporary breakpoint 1, main () at ambig.cc:15 15 Z z; 16 return 0; 89 'Y' But GDB 12 gives an error: $ ~/gcc/gdb/11/bin/gdb -ex start -ex n -ex "py print(gdb.parse_and_eval('z')['i'])" a.out GNU gdb (GDB) 12.0.50.20211020-git Copyright (C) 2021 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-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.out... Temporary breakpoint 1 at 0x40110a: file ambig.cc, line 15. Starting program: /tmp/a.out Temporary breakpoint 1, main () at ambig.cc:15 15 Z z; 16 return 0; Traceback (most recent call last): File "<string>", line 1, in <module> gdb.error: Request for member 'i' is ambiguous in type 'Z'. Candidates are: 'int X::i' (Z -> X) 'char Y::i' (Z -> Y) Error while executing Python code. I wonder why there wasn't an error for tuple_member['_M_head_impl'] in the libstdc++ printer. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-11-04 17:36 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-20 22:43 [Bug gdb/28480] New: " jwakely.gcc at gmail dot com 2021-10-21 0:44 ` [Bug gdb/28480] " jwakely.gcc at gmail dot com 2021-10-21 0:49 ` jwakely.gcc at gmail dot com 2021-10-21 0:56 ` jwakely.gcc at gmail dot com 2021-10-21 3:23 ` simark at simark dot ca 2021-10-21 8:44 ` jwakely.gcc at gmail dot com 2021-10-26 19:14 ` blarsen at redhat dot com 2021-11-04 16:01 ` blarsen at redhat dot com 2021-11-04 16:52 ` jwakely.gcc at gmail dot com 2021-11-04 17:06 ` jwakely.gcc at gmail dot com 2021-11-04 17:09 ` jwakely.gcc at gmail dot com 2021-11-04 17:36 ` jwakely.gcc at gmail dot com [this message] 2021-11-04 17:42 ` jwakely.gcc at gmail dot com 2021-11-04 17:53 ` jwakely.gcc at gmail dot com 2021-11-04 17:56 ` simark at simark dot ca 2021-11-04 17:59 ` simark at simark dot ca 2021-11-04 18:07 ` blarsen at redhat dot com 2021-11-04 18:45 ` pedro at palves dot net 2021-11-04 19:40 ` blarsen at redhat dot com 2021-11-05 13:53 ` blarsen at redhat dot com 2021-11-05 14:29 ` [Bug c++/28480] Incorrect field ambiguity detection due to [[no_unique_address]] simark at simark dot ca 2021-11-25 12:56 ` cvs-commit at gcc dot gnu.org 2021-11-25 15:25 ` blarsen at redhat dot com 2021-12-11 7:49 ` cvs-commit at gcc dot gnu.org
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=bug-28480-4717-yo1ZwXWCvW@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /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: linkBe 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).