From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86985 invoked by alias); 2 Jun 2017 19:37:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 86889 invoked by uid 89); 2 Jun 2017 19:36:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=H*m:3173, Hx-spam-relays-external:sk:gproxy4, H*F:U*tom, Hx-spam-relays-external:69.89.23.142 X-HELO: gproxy4.mail.unifiedlayer.com Received: from gproxy4-pub.mail.unifiedlayer.com (HELO gproxy4.mail.unifiedlayer.com) (69.89.23.142) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Jun 2017 19:36:57 +0000 Received: from cmgw2 (unknown [10.0.90.83]) by gproxy4.mail.unifiedlayer.com (Postfix) with ESMTP id 9F06C176A4F for ; Fri, 2 Jun 2017 13:37:00 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id Tvcx1v00h2f2jeq01vd0kA; Fri, 02 Jun 2017 13:37:00 -0600 X-Authority-Analysis: v=2.2 cv=Ibz3YSia c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=LWSFodeU3zMA:10 a=zstS-IiYAAAA:8 a=KPq8r9Yvpuk1AvaYTpoA:9 a=oJDEux_aEYikBhk7:21 a=aUQA-4iIrJ_BH2AM:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-29-39-24.hlrn.qwest.net ([174.29.39.24]:55096 helo=pokyo.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dGsNV-0003ge-Ff; Fri, 02 Jun 2017 13:36:57 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 4/5] Remove val_print_type_code_int Date: Fri, 02 Jun 2017 19:37:00 -0000 Message-Id: <20170602193651.3173-5-tom@tromey.com> In-Reply-To: <20170602193651.3173-1-tom@tromey.com> References: <20170602193651.3173-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dGsNV-0003ge-Ff X-Source-Sender: 174-29-39-24.hlrn.qwest.net (pokyo.Home) [174.29.39.24]:55096 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-06/txt/msg00070.txt.bz2 Now that print_scalar_formatted is more capable, there's no need for val_print_type_code_int. This patch removes it in favor of val_print_scalar_formatted. 2017-06-02 Tom Tromey * valprint.h (val_print_type_code_int): Remove. * valprint.c (generic_val_print_int): Always call val_print_scalar_formatted. (val_print_type_code_int): Remove. * printcmd.c (print_scalar_formatted): Handle options->format==0. * f-valprint.c (f_val_print): Use val_print_scalar_formatted. * c-valprint.c (c_val_print_int): Use val_print_scalar_formatted. * ada-valprint.c (ada_val_print_num): Use val_print_scalar_formatted. --- gdb/ChangeLog | 12 +++++++++++ gdb/ada-valprint.c | 3 ++- gdb/c-valprint.c | 4 ++-- gdb/f-valprint.c | 3 ++- gdb/valprint.c | 60 +++++------------------------------------------------- gdb/valprint.h | 3 --- 6 files changed, 23 insertions(+), 62 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 731d908..55bb725 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2017-06-02 Tom Tromey + * valprint.h (val_print_type_code_int): Remove. + * valprint.c (generic_val_print_int): Always call + val_print_scalar_formatted. + (val_print_type_code_int): Remove. + * printcmd.c (print_scalar_formatted): Handle options->format==0. + * f-valprint.c (f_val_print): Use val_print_scalar_formatted. + * c-valprint.c (c_val_print_int): Use val_print_scalar_formatted. + * ada-valprint.c (ada_val_print_num): Use + val_print_scalar_formatted. + +2017-06-02 Tom Tromey + * printcmd.c (print_scalar_formatted): Unify the two switches. Don't convert scalars to LONGEST. diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index d2489a2..8095eed 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -859,7 +859,8 @@ ada_val_print_num (struct type *type, const gdb_byte *valaddr, } else { - val_print_type_code_int (type, valaddr + offset_aligned, stream); + val_print_scalar_formatted (type, offset_aligned, + original_value, options, 0, stream); if (ada_is_character_type (type)) { LONGEST c; diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index ab1de5c..653fed6 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -454,8 +454,8 @@ c_val_print_int (struct type *type, struct type *unresolved_type, } else { - val_print_type_code_int (type, valaddr + embedded_offset * unit_size, - stream); + val_print_scalar_formatted (type, embedded_offset, + original_value, options, 0, stream); /* C and C++ has no single byte int type, char is used instead. Since we don't know whether the value is really intended to be used as an integer or a character, print diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index a517406..4234447 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -311,7 +311,8 @@ f_val_print (struct type *type, int embedded_offset, } else { - val_print_type_code_int (type, valaddr + embedded_offset, stream); + val_print_scalar_formatted (type, embedded_offset, + original_value, options, 0, stream); /* C and C++ has no single byte int type, char is used instead. Since we don't know whether the value is really intended to be used as an integer or a character, print the character diff --git a/gdb/valprint.c b/gdb/valprint.c index fcd74f1..67b737f 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -781,25 +781,12 @@ generic_val_print_int (struct type *type, struct value *original_value, const struct value_print_options *options) { - struct gdbarch *gdbarch = get_type_arch (type); - int unit_size = gdbarch_addressable_memory_unit_size (gdbarch); - - if (options->format || options->output_format) - { - struct value_print_options opts = *options; - - opts.format = (options->format ? options->format - : options->output_format); - val_print_scalar_formatted (type, embedded_offset, - original_value, &opts, 0, stream); - } - else - { - const gdb_byte *valaddr = value_contents_for_printing (original_value); + struct value_print_options opts = *options; - val_print_type_code_int (type, valaddr + embedded_offset * unit_size, - stream); - } + opts.format = (options->format ? options->format + : options->output_format); + val_print_scalar_formatted (type, embedded_offset, + original_value, &opts, 0, stream); } /* generic_val_print helper for TYPE_CODE_CHAR. */ @@ -1237,43 +1224,6 @@ value_print (struct value *val, struct ui_file *stream, LA_VALUE_PRINT (val, stream, options); } -/* Called by various _val_print routines to print - TYPE_CODE_INT's. TYPE is the type. VALADDR is the address of the - value. STREAM is where to print the value. */ - -void -val_print_type_code_int (struct type *type, const gdb_byte *valaddr, - struct ui_file *stream) -{ - enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); - - if (TYPE_LENGTH (type) > sizeof (LONGEST)) - { - LONGEST val; - - if (TYPE_UNSIGNED (type) - && extract_long_unsigned_integer (valaddr, TYPE_LENGTH (type), - byte_order, &val)) - { - print_longest (stream, 'u', 0, val); - } - else - { - /* Signed, or we couldn't turn an unsigned value into a - LONGEST. For signed values, one could assume two's - complement (a reasonable assumption, I think) and do - better than this. */ - print_hex_chars (stream, (unsigned char *) valaddr, - TYPE_LENGTH (type), byte_order, false); - } - } - else - { - print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, - unpack_long (type, valaddr)); - } -} - static void val_print_type_code_flags (struct type *type, const gdb_byte *valaddr, struct ui_file *stream) diff --git a/gdb/valprint.h b/gdb/valprint.h index f71d4ab..302626d 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -121,9 +121,6 @@ extern void val_print_array_elements (struct type *, LONGEST, const struct value_print_options *, unsigned int); -extern void val_print_type_code_int (struct type *, const gdb_byte *, - struct ui_file *); - extern void val_print_scalar_formatted (struct type *, LONGEST, struct value *, -- 2.9.3