From patchwork Sun Dec 8 18:29:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36633 Received: (qmail 26934 invoked by alias); 8 Dec 2019 18:51:09 -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 26868 invoked by uid 89); 8 Dec 2019 18:51:08 -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: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2019 18:51:07 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 4642C229B for ; Sun, 8 Dec 2019 12:30:04 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id e1Jki5sH1W4fre1JkiS078; Sun, 08 Dec 2019 12:30:04 -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=7gyDASsJwObZTuzoyg4jaQzn1ZbuNtGz9eXf62j2dDQ=; b=JKdBqktAsMPEwdONAImL4/pN5j uDQk1i4L2e/MJiu0fdSbOH0RoiaGI1C8PxcJr0FH4PKS7C2Rkr8oWRBXyl2LQXyWisWyOYfKiOOoJ +NRc3d/5gChwXyIP/6AHCnVgn; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:53620 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1ie1Jk-0045Dk-3A; Sun, 08 Dec 2019 11:30:04 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 17/55] Introduce c_value_print_inner Date: Sun, 8 Dec 2019 11:29:20 -0700 Message-Id: <20191208182958.10181-18-tom@tromey.com> In-Reply-To: <20191208182958.10181-1-tom@tromey.com> References: <20191208182958.10181-1-tom@tromey.com> This introduces c_value_print_inner, which implements the la_value_print_inner method for the C family of languages. In this patch, it is just a simple wrapper of c_val_print. However, subsequent patches will convert it to use the value API. The transformation is done this way to make each patch easier to review. Future patches will apply this same treatment to other languages as well. gdb/ChangeLog 2019-12-08 Tom Tromey * opencl-lang.c (opencl_language_defn): Use c_value_print_inner. * objc-lang.c (objc_language_defn): Use c_value_print_inner. * c-valprint.c (c_value_print_inner): New function. * c-lang.h (c_value_print_inner): Declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Use c_value_print_inner. Change-Id: I9b9fe017f5260154cd6d16c958827d3887fba5d2 --- gdb/ChangeLog | 10 ++++++++++ gdb/c-lang.c | 8 ++++---- gdb/c-lang.h | 5 +++++ gdb/c-valprint.c | 11 +++++++++++ gdb/objc-lang.c | 2 +- gdb/opencl-lang.c | 2 +- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 24c2eef747a..909c6de63d9 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -904,7 +904,7 @@ extern const struct language_defn c_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ @@ -1050,7 +1050,7 @@ extern const struct language_defn cplus_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ cplus_skip_trampoline, /* Language specific skip_trampoline */ @@ -1105,7 +1105,7 @@ extern const struct language_defn asm_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ @@ -1160,7 +1160,7 @@ extern const struct language_defn minimal_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/c-lang.h b/gdb/c-lang.h index de291fa8f13..8523a0b68c5 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -87,6 +87,11 @@ extern void c_val_print (struct type *, struct value *, const struct value_print_options *); +/* Implement la_value_print_inner for the C family of languages. */ + +extern void c_value_print_inner (struct value *, struct ui_file *, int, + const struct value_print_options *); + extern void c_value_print (struct value *, struct ui_file *, const struct value_print_options *); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 5753a5869c3..410771b03d7 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -557,6 +557,17 @@ c_val_print (struct type *type, break; } } + +/* See c-lang.h. */ + +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); +} + void c_value_print (struct value *val, struct ui_file *stream, diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index e6cb42e60a2..c1444163114 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -382,7 +382,7 @@ extern const struct language_defn objc_language_defn = { c_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ objc_skip_trampoline, /* Language specific skip_trampoline */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 8ebb35b9e62..7933e68b614 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1061,7 +1061,7 @@ extern const struct language_defn opencl_language_defn = opencl_print_type, /* Print a type using appropriate syntax */ c_print_typedef, /* Print a typedef using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ - nullptr, /* la_value_print_inner */ + c_value_print_inner, /* la_value_print_inner */ c_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */