From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 4DB593857C5C; Fri, 23 Sep 2022 08:52:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DB593857C5C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663923168; bh=xY2AFr/SJOo9Oy0G7SIrI7RZnmCsSmZSaoUHwJ9KzQ4=; h=From:To:Subject:Date:From; b=yeudoftEzGWQZwsNGqJ7k2hz2ilZLt7WnLiuZHwfq6tQb7VkJ3vJqyFj7CF62QBbb SaoeLUcYltzAU7uv440Z6X4uVOo8/m0iw2i6CthHHsI3jViqtncD8NBZ8YPZMyyFeJ mFl0Oev7VkG06viSH+wVVZy4bdaZEABvb64/sTU8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2809] Add debug functions for REAL_VALUE_TYPE. X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: 0706262498bc5d206330c08414df0c780a0c3141 X-Git-Newrev: 76dbbfe62c0d7f4548cb12e757f67a1b1f84c3df Message-Id: <20220923085248.4DB593857C5C@sourceware.org> Date: Fri, 23 Sep 2022 08:52:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:76dbbfe62c0d7f4548cb12e757f67a1b1f84c3df commit r13-2809-g76dbbfe62c0d7f4548cb12e757f67a1b1f84c3df Author: Aldy Hernandez 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,