From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GM/HFH5RHmK2ewAAWB0awg (envelope-from ) for ; Tue, 01 Mar 2022 12:01:50 -0500 Received: by simark.ca (Postfix, from userid 112) id 52F851F3CA; Tue, 1 Mar 2022 12:01:50 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 D6D3D1EA69 for ; Tue, 1 Mar 2022 12:01:49 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CA9F385841F for ; Tue, 1 Mar 2022 17:01:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CA9F385841F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646154109; bh=/71WBx3fRJBRKMZRJrpu0TYrMroUoznwMCWE07s7A+8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=grdRzNjdADg63UrEm5W03Jq/ui9jl7SR0b41QXfphB9epG4m17fSRIkJIgWkwQptp 6e2cT5pGdF2NOURkjx61LYuPair0ZymWXICV5Xogs1+nQ3Qu5nfs8iaQghFjAC6JhL QF1YLBA5QQJEk1UEym5NWoBrGiKSUzWx/5iECOu4= Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id C32C03858C74 for ; Tue, 1 Mar 2022 17:00:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C32C03858C74 Received: by mail-io1-xd2c.google.com with SMTP id c18so19159742ioc.6 for ; Tue, 01 Mar 2022 09:00:59 -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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/71WBx3fRJBRKMZRJrpu0TYrMroUoznwMCWE07s7A+8=; b=6FZXtfHgr272yrfSAOg2XqUkvFkVVZ71ezSYkRgefEe25RJuq2Vg5+ACkr+wbHnJQl 7GZNhNRizTfxLmn48CTdWuYHmEYNRNR2SDyRD2VqyGRD7dFVNlIbV5CEXzyItAjA0SAn J2ncGPGcpbG6GEgrRqCHT6EOvxJimXwsS5m8AfTrcA1SVjde5syUyK1f9roKl6BUEifJ hnjZ0PMbkVa5D/TIG/cnwYikdAQk2HFh9qLSw08sXae+vmzL4lyrFKL4X2qKwYUFzxVI GShh6YJJv7TCAac+ankTeH2BAXZ4kgnN8gu4lfIVqYiDdx3bchIM/dS2gMIDM0dsSrGt DXeQ== X-Gm-Message-State: AOAM533nQn8y7kZBasHzFwjWjW2nthULn3BDnDLNlF6h2q2iDRuoEeKJ Rq9zeKjnIVfTxV0WY2CvirDxazhIv9ZO8Q== X-Google-Smtp-Source: ABdhPJyLFJL6JMTSHsz8UW1twUqaZUuO7rn2Aatl7bLWQvfugvMqSh7fhPH1VUdNd2F31uCZA092Kw== X-Received: by 2002:a6b:6b19:0:b0:640:a354:69ef with SMTP id g25-20020a6b6b19000000b00640a35469efmr20161949ioc.186.1646154059090; Tue, 01 Mar 2022 09:00:59 -0800 (PST) Received: from murgatroyd.Home (75-166-141-253.hlrn.qwest.net. [75.166.141.253]) by smtp.gmail.com with ESMTPSA id 6-20020a056e0211a600b002c2494a5479sm8214281ilj.2.2022.03.01.09.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 09:00:58 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH 3/3] Fix bug in ada_print_floating Date: Tue, 1 Mar 2022 10:00:55 -0700 Message-Id: <20220301170055.1520935-4-tromey@adacore.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220301170055.1520935-1-tromey@adacore.com> References: <20220301170055.1520935-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" ada_print_floating rewrites a floating-point string representation to conform to Ada syntax. However, if you managed to get a floating point error, you might see: (gdb) print whatever $2 = What's happening here is that ada_print_floating doesn't recognize this error case, and proceeds to modify the error text. This patch fixes this problem. --- gdb/ada-valprint.c | 7 +++++++ gdb/testsuite/gdb.ada/float-bits.exp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index bf95719f040..e113088491c 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -314,6 +314,13 @@ ada_print_floating (const gdb_byte *valaddr, struct type *type, std::string s = tmp_stream.release (); size_t skip_count = 0; + /* Don't try to modify a result representing an error. */ + if (s[0] == '<') + { + fputs_filtered (s.c_str (), stream); + return; + } + /* Modify for Ada rules. */ size_t pos = s.find ("inf"); diff --git a/gdb/testsuite/gdb.ada/float-bits.exp b/gdb/testsuite/gdb.ada/float-bits.exp index 61db5f325ad..c98afb53c06 100644 --- a/gdb/testsuite/gdb.ada/float-bits.exp +++ b/gdb/testsuite/gdb.ada/float-bits.exp @@ -48,3 +48,6 @@ gdb_test "print val_long_double := 16llf#7FFFF7FF4054A56FA5B99019A5C8#" \ " = 5.0e\\+25" gdb_test "print val_long_double" " = 5.0e\\+25" \ "print val_long_double after assignment" + +gdb_test "print 16llf#a56fa5b99019a5c800007ffff7ff4054#" \ + " = " -- 2.31.1