From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id P6zIJfzAEGKXMwAAWB0awg (envelope-from ) for ; Sat, 19 Feb 2022 05:05:48 -0500 Received: by simark.ca (Postfix, from userid 112) id 85D9E1F3C9; Sat, 19 Feb 2022 05:05:48 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 920C61EA69 for ; Sat, 19 Feb 2022 05:05:42 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A8D938515C9 for ; Sat, 19 Feb 2022 10:05:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A8D938515C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1645265141; bh=NAQSJ7MIW3ik90fyNh52SWGo4Hz+OykzPipaOt10kIA=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cfQhfRtKQpuwJ2WDcynqvS3VgTkJz+yNGKLYEB7l3wQtJtPRcAaJcWeeIO3v9jHsQ 882Zy0m7iC8sSRt/mXQ2ccW1luiWeKNWmMMJaecGSpdq7xZ8I7NpKUC7n31UKFG5/+ OvypkfbLNXOaiQchrlH3V+zMu5nZgwZJ+GlsnaoU= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 4D8533858D1E for ; Sat, 19 Feb 2022 10:05:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D8533858D1E Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-COcW0PH_P3qUVXmYsUT9WQ-1; Sat, 19 Feb 2022 05:05:21 -0500 X-MC-Unique: COcW0PH_P3qUVXmYsUT9WQ-1 Received: by mail-wr1-f69.google.com with SMTP id u9-20020adfae49000000b001e89793bcb0so3035297wrd.17 for ; Sat, 19 Feb 2022 02:05:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=NAQSJ7MIW3ik90fyNh52SWGo4Hz+OykzPipaOt10kIA=; b=65dFdHVbrj4u8L7VCfXOmbO6kmTPg68QrNLaB+fRhjKE5oOj08MtgXCmvEeF67lEPJ qIGLVuqj0f0GEqpfAv0i7AcDxd+rl9N3i6q7TY0CxQpHfhScMgbk+kcmjlcTR1bpxCTN cidyXi6nTB8G8MtEBlC6T2PfVw0rpWNLigr+zLB4yPBcwrvxzD6bY9omkS6Vk9XD7rgv t4CbgPQG+O0HUTNhf6yLDJdmTOcG5TjPdi1EmMktvOdofYUoaM+Uyk/LFYeUHIhuZbco jnVKZVgKdkp41Svoge1m8vpBizhFwG5lYVwRNZwk5FKtUJpAPo4kOyUK7B41QONm8ga+ WWTg== X-Gm-Message-State: AOAM530lYnvPdk7mRtvZPf32wWkRh9fyF7qiONXQNxGJ+iFhuXf61Kug 6/8hUMw/bbdXluKRrZ/9KnQH0GJOz4vAwP2ahummMiBHgKN+CxqPbpIxn4/h+O4g83vno3fVN8F Q151xz33KBM1U9WAAQafrpw== X-Received: by 2002:adf:fbd0:0:b0:1e6:8ec3:570 with SMTP id d16-20020adffbd0000000b001e68ec30570mr9516401wrs.396.1645265119801; Sat, 19 Feb 2022 02:05:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkvMvJyNJZpMeUbUy9A7YD/sCrwwWjsAjGnetNhp7Pgi+nNj4siAnZmYzKeDB1VJZIr2W6vQ== X-Received: by 2002:adf:fbd0:0:b0:1e6:8ec3:570 with SMTP id d16-20020adffbd0000000b001e68ec30570mr9516385wrs.396.1645265119550; Sat, 19 Feb 2022 02:05:19 -0800 (PST) Received: from localhost (host86-134-151-224.range86-134.btcentralplus.com. [86.134.151.224]) by smtp.gmail.com with ESMTPSA id b7sm33372920wrp.23.2022.02.19.02.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:05:18 -0800 (PST) To: Andreas Schwab , Tom Tromey via Gdb-patches Subject: Re: [PATCH] Change how "print/x" displays floating-point value In-Reply-To: <87zgmovzr9.fsf@igel.home> References: <20220217212957.1747537-1-tromey@adacore.com> <874k4xdqwl.fsf@redhat.com> <87k0dsqg47.fsf@tromey.com> <87zgmovzr9.fsf@igel.home> Date: Sat, 19 Feb 2022 10:05:17 +0000 Message-ID: <871qzzdvdu.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Andreas Schwab writes: > On Feb 18 2022, Tom Tromey via Gdb-patches wrote: > >> diff --git a/gdb/NEWS b/gdb/NEWS >> index 9da74e71796..544efa3fe74 100644 >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -97,6 +97,12 @@ show style disassembler enabled >> >> * Changed commands >> >> +print >> + Printing of floating-point values with base-modifying formats like >> + /x has been changed to display the underlying bytes of the value in >> + the desired base. This was GDB's documented behavior, but was never >> + implemented correctly. > > How does that handle padding? > >> diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp >> index 37632985a07..78a2147017d 100644 >> --- a/gdb/testsuite/gdb.base/printcmds.exp >> +++ b/gdb/testsuite/gdb.base/printcmds.exp >> @@ -158,8 +158,14 @@ proc test_float_rejected {} { >> # 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" >> + >> + # See PR gdb/16242 for this. >> + gdb_test "print/d 1.5f" " = 1069547520" >> + gdb_test "print/u 1.5f" " = 1069547520" >> + gdb_test "print/x 1.5f" " = 0x3fc00000" >> + gdb_test "print/t 1.5f" " = 111111110000000000000000000000" >> + gdb_test "print/o 1.5f" " = 07760000000" > > That assumes a particular representation of the float type that depends > on the target. Maybe we can harden the tests in this case with some logic like (psuedo-code): ## Assuming printcmds.c contains: ## float f_var = 1.5f; if { sizeof(int) == sizeof(float) } { set expected_value [valueof "p/d *((int *) &f_var)"] gdb_test "print/d f_var" "$expected_value" } As I think these two methods of printing are now the same, right? Thanks, Andrew