From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 056B33858D33 for ; Thu, 2 Mar 2023 21:00:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 056B33858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BD88F1E0D3; Thu, 2 Mar 2023 16:00:00 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1677790800; bh=2eMJlhYXt/Pxk4I7wqP5i7g+pl1tIMBG/vbU5gt+8Hk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DM0xL17+q3G5AOQhvPuUWBAHzpV3tnkA1RnnxCCXnU6EEXJCQkKbsjrkoZ/UX/Lm0 WmnMZQ7iNxaH/jgMUJXGGzUKPLnDu/q5sdzKY6j4e4T5yN1rxv8KJMJiJS8JfHpPJr iJUsuZQDjtlwutnH4tFptXpVCpt8+qYahlWDBj4w= Message-ID: <82763e1a-2d25-1ab0-ce08-09ce3719faaa@simark.ca> Date: Thu, 2 Mar 2023 16:00:00 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] Handle half-float in 'x' command Content-Language: fr To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20230224163834.2675084-1-tromey@adacore.com> <58b76ee1-d004-14a3-a47e-2108e5aa7e62@simark.ca> <87mt4vb19j.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87mt4vb19j.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/2/23 10:50, Tom Tromey wrote: > Simon> Can you add a comment before the section you added, to indicate what it > Simon> intends to test? > > I mean to say, I did it. Thanks for the review. Oops, this causes: p/f *(short *)s^M $41 = 1.7345e-05^M (gdb) FAIL: gdb.base/long_long.exp: p/f *(short *)s x/2hf h^M 0x555555558060 : 1.7345e-05 -0.028046^M (gdb) FAIL: gdb.base/long_long.exp: x/2hf h I think it's just the test outcomes that need to be updated. It goes through that code: https://gitlab.com/gnutools/binutils-gdb/-/blob/70728e1d396475e8e630bfdd3fb8e8c8211bdbbd/gdb/printcmd.c#L455-464 /* Printing a non-float type as 'f' will interpret the data as if it were of a floating-point type of the same length, if that exists. Otherwise, the data is printed as integer. */ char format = options->format; if (format == 'f' && type->code () != TYPE_CODE_FLT) { type = float_type_from_length (type); if (type->code () != TYPE_CODE_FLT) format = 0; } Before, we didn't find a 2-byte float format, so it was printed as integers, and now we do, so it's printed as a float. It seems consistent with the comment in the code. Simon