From patchwork Sun Dec 8 18:29:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36636 Received: (qmail 36742 invoked by alias); 8 Dec 2019 18:52:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36732 invoked by uid 89); 8 Dec 2019 18:52:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.187.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2019 18:52:39 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 9B3574028F132 for ; Sun, 8 Dec 2019 11:40:29 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id e1JpiY9QhiJ43e1JpizFKP; Sun, 08 Dec 2019 12:30:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/EYsGUqkE9z3b9/f5uht+OwcsJwIwnhm4DqySZjuiFk=; b=kv22WBhpvlsf3wTA+ZMedZK24P xCdnjQn3NXam4v0cY8E+BxzA7N/I5x0w2aTK1L/jI4Fh59qxiQoKyFih74m+05RoA39DYwvSAkMgL /X/rgNV6Th+q8ZjJoGREk1JFG; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:53624 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1ie1Jp-0045Im-1W; Sun, 08 Dec 2019 11:30:09 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 37/55] Simplify generic_val_print_float Date: Sun, 8 Dec 2019 11:29:40 -0700 Message-Id: <20191208182958.10181-38-tom@tromey.com> In-Reply-To: <20191208182958.10181-1-tom@tromey.com> References: <20191208182958.10181-1-tom@tromey.com> This changes generic_val_print_float not to call val_print_scalar_formatted. This lets generic_value_print then use value_print_scalar_formatted instead. gdb/ChangeLog 2019-12-08 Tom Tromey * valprint.c (generic_val_print_float): Don't call val_print_scalar_formatted. (generic_val_print, generic_value_print): Update. Change-Id: I00b73411232adf768c11d0d5271218644a6e390f --- gdb/ChangeLog | 6 ++++++ gdb/valprint.c | 29 +++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gdb/valprint.c b/gdb/valprint.c index 4e65115cf97..630b6567cd0 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -898,17 +898,11 @@ generic_val_print_float (struct type *type, struct gdbarch *gdbarch = get_type_arch (type); int unit_size = gdbarch_addressable_memory_unit_size (gdbarch); - if (options->format) - { - val_print_scalar_formatted (type, embedded_offset, - original_value, options, 0, stream); - } - else - { - const gdb_byte *valaddr = value_contents_for_printing (original_value); + gdb_assert (!options->format); - print_floating (valaddr + embedded_offset * unit_size, type, stream); - } + const gdb_byte *valaddr = value_contents_for_printing (original_value); + + print_floating (valaddr + embedded_offset * unit_size, type, stream); } /* generic_val_print helper for TYPE_CODE_COMPLEX. */ @@ -1047,8 +1041,12 @@ generic_val_print (struct type *type, case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: - generic_val_print_float (type, embedded_offset, stream, - original_value, options); + if (options->format) + val_print_scalar_formatted (type, embedded_offset, + original_value, options, 0, stream); + else + generic_val_print_float (type, embedded_offset, stream, + original_value, options); break; case TYPE_CODE_VOID: @@ -1159,8 +1157,11 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: - generic_val_print_float (type, 0, stream, - val, options); + if (options->format) + value_print_scalar_formatted (val, options, 0, stream); + else + generic_val_print_float (type, 0, stream, + val, options); break; case TYPE_CODE_VOID: