public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2809] Add debug functions for REAL_VALUE_TYPE. Date: Fri, 23 Sep 2022 08:52:48 +0000 (GMT) [thread overview] Message-ID: <20220923085248.4DB593857C5C@sourceware.org> (raw) https://gcc.gnu.org/g:76dbbfe62c0d7f4548cb12e757f67a1b1f84c3df commit r13-2809-g76dbbfe62c0d7f4548cb12e757f67a1b1f84c3df Author: Aldy Hernandez <aldyh@redhat.com> Date: Thu Sep 22 18:03:16 2022 +0200 Add debug functions for REAL_VALUE_TYPE. We currently have no way of dumping REAL_VALUE_TYPEs when debugging. Tested on a gdb session examining the real value 10.0: (gdb) p min $9 = {cl = 1, decimal = 0, sign = 0, signalling = 0, canonical = 0, uexp = 4, sig = {0, 0, 11529215046068469760}} (gdb) p debug (min) 0x0.ap+4 gcc/ChangeLog: * real.cc (debug): New. Diff: --- gcc/real.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/real.cc b/gcc/real.cc index 73bbac645d9..aae7c335d59 100644 --- a/gcc/real.cc +++ b/gcc/real.cc @@ -1900,6 +1900,14 @@ real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size, digits, crop_trailing_zeros, VOIDmode); } +DEBUG_FUNCTION void +debug (const REAL_VALUE_TYPE &r) +{ + char s[60]; + real_to_hexadecimal (s, &r, sizeof (s), 0, 1); + fprintf (stderr, "%s\n", s); +} + /* Render R as a hexadecimal floating point constant. Emit DIGITS significant digits in the result, bounded by BUF_SIZE. If DIGITS is 0, choose the maximum for the representation. If CROP_TRAILING_ZEROS,
reply other threads:[~2022-09-23 8:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220923085248.4DB593857C5C@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@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: 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).