From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44047 invoked by alias); 25 Aug 2017 16:54:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 44030 invoked by uid 89); 25 Aug 2017 16:54:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Aug 2017 16:54:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C71C80D; Fri, 25 Aug 2017 09:54:44 -0700 (PDT) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2195E3F578; Fri, 25 Aug 2017 09:54:43 -0700 (PDT) Subject: Re: [RFA 1/2] Fix two regressions in scalar printing To: Tom Tromey , gdb-patches@sourceware.org References: <20170713123400.28917-1-tom@tromey.com> <20170713123400.28917-2-tom@tromey.com> From: Thomas Preudhomme Message-ID: <964b3838-d96d-f0d3-9dbd-04add95bf609@foss.arm.com> Date: Fri, 25 Aug 2017 16:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170713123400.28917-2-tom@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00489.txt.bz2 Hi Tom, As raised in [1], this patch creates a regression on arm targets in: gdb.base/sizeof.exp: check valueof "'\377'" I've taken the liberty of creating a bugzilla ticket [2] where I added some more info of things I've tried. [1] https://sourceware.org/ml/gdb-testers/2017-q3/msg01944.html [2] https://sourceware.org/bugzilla/show_bug.cgi?id=22010 Please let me know if I can be of any help in fixing that bug. Best regards, Thomas On 13/07/17 13:33, Tom Tromey wrote: > PR gdb/21675 points out a few regressions in scalar printing. > > One type of regression is due to not carrying over the old handling of > floating point printing -- where a format like "/x" causes a floating > point number to first be cast to integer. While this behavior does not > seem very useful to me, apparently at least one person is testing for > it, and we did agree in the earlier thread to preserve this. So, this > patch extends this behavior to the 'd' and 'u' formats. > > The other regression is a longstanding bug in print_octal_chars: one of > the constants was wrong. This patch fixes the constant and adds static > asserts to help catch this sort of error. > > 2017-07-13 Tom Tromey > > PR gdb/21675 > * valprint.c (LOW_ZERO): Change value to 034. > (print_octal_chars): Add static_asserts for octal constants. > * printcmd.c (print_scalar_formatted): Add 'd' and 'u' to special > cases for float types. > > 2017-07-13 Tom Tromey > > PR gdb/21675: > * gdb.base/printcmds.exp (test_radices): New function. > --- > gdb/ChangeLog | 8 ++++++++ > gdb/printcmd.c | 11 ++++++++--- > gdb/testsuite/ChangeLog | 5 +++++ > gdb/testsuite/gdb.base/printcmds.exp | 8 ++++++++ > gdb/valprint.c | 8 +++++++- > 5 files changed, 36 insertions(+), 4 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index 012b3e4..5ac5bab 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,11 @@ > +2017-07-13 Tom Tromey > + > + PR gdb/21675 > + * valprint.c (LOW_ZERO): Change value to 034. > + (print_octal_chars): Add static_asserts for octal constants. > + * printcmd.c (print_scalar_formatted): Add 'd' and 'u' to special > + cases for float types. > + > 2017-07-11 John Baldwin > > * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use > diff --git a/gdb/printcmd.c b/gdb/printcmd.c > index a8cc052..cd615ec 100644 > --- a/gdb/printcmd.c > +++ b/gdb/printcmd.c > @@ -413,7 +413,9 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, > && (options->format == 'o' > || options->format == 'x' > || options->format == 't' > - || options->format == 'z')) > + || options->format == 'z' > + || options->format == 'd' > + || options->format == 'u')) > { > LONGEST val_long = unpack_long (type, valaddr); > converted_float_bytes.resize (TYPE_LENGTH (type)); > @@ -427,11 +429,14 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, > case 'o': > print_octal_chars (stream, valaddr, len, byte_order); > break; > + case 'd': > case 'u': > - print_decimal_chars (stream, valaddr, len, false, byte_order); > + { > + bool is_signed = options->format != 'u' || !TYPE_UNSIGNED (type); > + print_decimal_chars (stream, valaddr, len, is_signed, byte_order); > + } > break; > case 0: > - case 'd': > if (TYPE_CODE (type) != TYPE_CODE_FLT) > { > print_decimal_chars (stream, valaddr, len, !TYPE_UNSIGNED (type), > diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog > index aa3dee3..0c8481b 100644 > --- a/gdb/testsuite/ChangeLog > +++ b/gdb/testsuite/ChangeLog > @@ -1,3 +1,8 @@ > +2017-07-13 Tom Tromey > + > + PR gdb/21675: > + * gdb.base/printcmds.exp (test_radices): New function. > + > 2017-07-11 Iain Buclaw > > * gdb.dlang/demangle.exp: Update for demangling changes. > diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp > index 323ca73..03275c3 100644 > --- a/gdb/testsuite/gdb.base/printcmds.exp > +++ b/gdb/testsuite/gdb.base/printcmds.exp > @@ -155,6 +155,13 @@ proc test_float_rejected {} { > test_print_reject "p 1.1ll" > } > > +# Regression test for PR gdb/21675 > +proc test_radices {} { > + gdb_test "print/o 16777211" " = 077777773" > + gdb_test "print/d 1.5" " = 1\[^.\]" > + gdb_test "print/u 1.5" " = 1\[^.\]" > +} > + > proc test_print_all_chars {} { > global gdb_prompt > > @@ -981,3 +988,4 @@ test_printf > test_printf_with_dfp > test_print_symbol > test_repeat_bytes > +test_radices > diff --git a/gdb/valprint.c b/gdb/valprint.c > index 1667882..9e216cf 100644 > --- a/gdb/valprint.c > +++ b/gdb/valprint.c > @@ -1593,15 +1593,21 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr, > */ > #define BITS_IN_OCTAL 3 > #define HIGH_ZERO 0340 > -#define LOW_ZERO 0016 > +#define LOW_ZERO 0034 > #define CARRY_ZERO 0003 > + static_assert (HIGH_ZERO + LOW_ZERO + CARRY_ZERO == 0xff, > + "cycle zero constants are wrong"); > #define HIGH_ONE 0200 > #define MID_ONE 0160 > #define LOW_ONE 0016 > #define CARRY_ONE 0001 > + static_assert (HIGH_ONE + MID_ONE + LOW_ONE + CARRY_ONE == 0xff, > + "cycle one constants are wrong"); > #define HIGH_TWO 0300 > #define MID_TWO 0070 > #define LOW_TWO 0007 > + static_assert (HIGH_TWO + MID_TWO + LOW_TWO == 0xff, > + "cycle two constants are wrong"); > > /* For 32 we start in cycle 2, with two bits and one bit carry; > for 64 in cycle in cycle 1, with one bit and a two bit carry. */ >