From patchwork Sun Dec 8 18:29:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36609 Received: (qmail 102448 invoked by alias); 8 Dec 2019 18:30:45 -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 101253 invoked by uid 89); 8 Dec 2019 18:30:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 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=H*r:esmtpa, H*RU:esmtpa, HX-Spam-Relays-External:esmtpa X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.46.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2019 18:30:13 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway21.websitewelcome.com (Postfix) with ESMTP id A666C400C787C for ; Sun, 8 Dec 2019 12:30:07 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id e1JniMghNHunhe1Jniex2B; Sun, 08 Dec 2019 12:30:07 -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=b2/mni1XwJA+aLAjJ6krTSb4es1v/Jb0cMV4jCOitYM=; b=I2pIWJgRBr+JSR00aC4HXDiZrK GD9/lSPXLI57yluzrJhZpE6nFW32+YYdnncfnmzRYauuVcGbWMcc5zWjkm2RHgpI0L9DoRUnXTxna K9/Ge+cSyBxLJZiAJ/VZQOx2O; 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 1ie1Jn-0045Im-GA; Sun, 08 Dec 2019 11:30:07 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 32/55] Remove generic_val_print_flags Date: Sun, 8 Dec 2019 11:29:35 -0700 Message-Id: <20191208182958.10181-33-tom@tromey.com> In-Reply-To: <20191208182958.10181-1-tom@tromey.com> References: <20191208182958.10181-1-tom@tromey.com> This remove generic_val_print_flags in favor of using the value-based API where possible. gdb/ChangeLog 2019-12-08 Tom Tromey * valprint.c (generic_val_print_flags): Remove. (generic_val_print, generic_value_print): Update. (val_print_type_code_flags): Add original_value parameter. Change-Id: Ideb43d103717afdf28d81130e8d1fe77a6a9ea09 --- gdb/ChangeLog | 6 ++++++ gdb/valprint.c | 43 ++++++++++++++++--------------------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/gdb/valprint.c b/gdb/valprint.c index fe7ffa78abc..c6de058fa23 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -87,7 +87,8 @@ static void set_input_radix_1 (int, unsigned); static void set_output_radix_1 (int, unsigned); static void val_print_type_code_flags (struct type *type, - const gdb_byte *valaddr, + struct value *original_value, + int embedded_offset, struct ui_file *stream); #define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */ @@ -704,26 +705,6 @@ generic_val_print_enum (struct type *type, generic_val_print_enum_1 (type, val, stream); } -/* generic_val_print helper for TYPE_CODE_FLAGS. */ - -static void -generic_val_print_flags (struct type *type, - int embedded_offset, struct ui_file *stream, - struct value *original_value, - const struct value_print_options *options) - -{ - 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); - - val_print_type_code_flags (type, valaddr + embedded_offset, stream); - } -} - /* generic_val_print helper for TYPE_CODE_FUNC and TYPE_CODE_METHOD. */ static void @@ -954,8 +935,12 @@ generic_val_print (struct type *type, break; case TYPE_CODE_FLAGS: - generic_val_print_flags (type, embedded_offset, stream, - original_value, options); + if (options->format) + val_print_scalar_formatted (type, embedded_offset, + original_value, options, 0, stream); + else + val_print_type_code_flags (type, original_value, embedded_offset, + stream); break; case TYPE_CODE_FUNC: @@ -1065,8 +1050,10 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, break; case TYPE_CODE_FLAGS: - generic_val_print_flags (type, 0, stream, - val, options); + if (options->format) + value_print_scalar_formatted (val, options, 0, stream); + else + val_print_type_code_flags (type, val, 0, stream); break; case TYPE_CODE_FUNC: @@ -1385,9 +1372,11 @@ value_print (struct value *val, struct ui_file *stream, } static void -val_print_type_code_flags (struct type *type, const gdb_byte *valaddr, - struct ui_file *stream) +val_print_type_code_flags (struct type *type, struct value *original_value, + int embedded_offset, struct ui_file *stream) { + const gdb_byte *valaddr = (value_contents_for_printing (original_value) + + embedded_offset); ULONGEST val = unpack_long (type, valaddr); int field, nfields = TYPE_NFIELDS (type); struct gdbarch *gdbarch = get_type_arch (type);