public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/107965] libstdc++ Python Pretty-Printers: Many Exceptions From Uninitialized Structures
Date: Mon, 05 Dec 2022 08:24:51 +0000	[thread overview]
Message-ID: <bug-107965-4-jEUrosL1xF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107965-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107965

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
They're nothing the printers can do. You're asking to print them out before
they are initialized, so they try to interpret garbage as values. The
OverflowError is just because some uninitialized std::string cannot be printed.

This should really be reported as a gdb bug. Gdb knows if the object's
initialization had finished, so it should not try to print variables at all
before their lifetime has begun, especially not via python printers.

It might make sense to display the variable name with a value like <before
lifetime>, but even that is debatable. The C++ standard is very clear that none
of those variables exists yet at your breakpoint, and gdb contradicts its own
documentation:

"These are all variables (declared either static or automatic) accessible at
the point of execution of the selected frame."

  parent reply	other threads:[~2022-12-05  8:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04 19:46 [Bug libstdc++/107965] New: " gustaf.waldemarson at gmail dot com
2022-12-04 20:04 ` [Bug libstdc++/107965] " pinskia at gcc dot gnu.org
2022-12-05  8:24 ` redi at gcc dot gnu.org [this message]
2022-12-05  8:45 ` rguenth at gcc dot gnu.org
2022-12-05  8:48 ` rguenth at gcc dot gnu.org
2022-12-05  9:42 ` [Bug debug/107965] " redi at gcc dot gnu.org
2022-12-05 10:37 ` redi at gcc dot gnu.org
2023-01-17 19:37 ` gustaf.waldemarson at gmail dot com
2023-01-17 20:25 ` jason 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-107965-4-jEUrosL1xF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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: 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).