From patchwork Sun Dec 8 18:29:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36629 Received: (qmail 114551 invoked by alias); 8 Dec 2019 18:32:22 -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 112307 invoked by uid 89); 8 Dec 2019 18:32:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 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: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2019 18:32:04 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 93C949E30 for ; Sun, 8 Dec 2019 12:30:09 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id e1JpipQvEqNtve1JpiYrYT; 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=ZtMBtpyLQJ2rFsqugmwC3P28lJkIrQC9p8YlbYiPZQk=; b=nO+wpUKvlT9VhOdYyb+QTJXmUV DDYKTNe4xj20sb1YmBdTtWWMaiVtUD1E0HV5Zje3yuCbVbDgl2zqcpbV5uAkuRhbWRDJWz9yF+OQC Akkg8Vg7E6WQE/FT61v4gYLYS; 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-DS; Sun, 08 Dec 2019 11:30:09 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 39/55] Rewrite c_value_print_inner Date: Sun, 8 Dec 2019 11:29:42 -0700 Message-Id: <20191208182958.10181-40-tom@tromey.com> In-Reply-To: <20191208182958.10181-1-tom@tromey.com> References: <20191208182958.10181-1-tom@tromey.com> This rewrites c_value_print_inner, copying in the body of c_val_print_inner and adusting as needed. This will form the base of future changes to fully convert this to using the value-based API gdb/ChangeLog 2019-12-08 Tom Tromey * c-valprint.c (c_value_print_inner): Rewrite. Change-Id: I128fdc78f22c8014e402f9cacb623216a3b0e4db --- gdb/ChangeLog | 4 +++ gdb/c-valprint.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 410771b03d7..af7a386fb78 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -564,8 +564,67 @@ void c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) { - c_val_print (value_type (val), value_embedded_offset (val), - value_address (val), stream, recurse, val, options); + struct type *type = value_type (val); + struct type *unresolved_type = type; + CORE_ADDR address = value_address (val); + const gdb_byte *valaddr = value_contents_for_printing (val); + + type = check_typedef (type); + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + c_val_print_array (type, valaddr, 0, address, stream, + recurse, val, options); + break; + + case TYPE_CODE_METHODPTR: + cplus_print_method_ptr (valaddr, type, stream); + break; + + case TYPE_CODE_PTR: + c_val_print_ptr (type, valaddr, 0, stream, recurse, + val, options); + break; + + case TYPE_CODE_UNION: + c_val_print_union (type, valaddr, 0, address, stream, + recurse, val, options); + break; + + case TYPE_CODE_STRUCT: + c_val_print_struct (type, valaddr, 0, address, stream, + recurse, val, options); + break; + + case TYPE_CODE_INT: + c_val_print_int (type, unresolved_type, valaddr, 0, stream, + val, options); + break; + + case TYPE_CODE_MEMBERPTR: + c_val_print_memberptr (type, valaddr, 0, address, stream, + recurse, val, options); + break; + + case TYPE_CODE_REF: + case TYPE_CODE_RVALUE_REF: + case TYPE_CODE_ENUM: + case TYPE_CODE_FLAGS: + case TYPE_CODE_FUNC: + case TYPE_CODE_METHOD: + case TYPE_CODE_BOOL: + case TYPE_CODE_RANGE: + case TYPE_CODE_FLT: + case TYPE_CODE_DECFLOAT: + case TYPE_CODE_VOID: + case TYPE_CODE_ERROR: + case TYPE_CODE_UNDEF: + case TYPE_CODE_COMPLEX: + case TYPE_CODE_CHAR: + default: + generic_value_print (val, stream, recurse, options, &c_decorations); + break; + } }