From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29660 invoked by alias); 11 Jul 2014 09:21:47 -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 29547 invoked by uid 89); 11 Jul 2014 09:21:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Jul 2014 09:21:44 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 11 Jul 2014 02:21:43 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 11 Jul 2014 02:21:41 -0700 Received: from ullecvh004g04.iul.intel.com (ullecvh004g04.iul.intel.com [172.28.50.14]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s6B9LeM1020718; Fri, 11 Jul 2014 10:21:40 +0100 Received: from ullecvh004g04.iul.intel.com (ullecvh004g04.iul.intel.com [127.0.0.1]) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8) with ESMTP id s6B9LfsR007017; Fri, 11 Jul 2014 11:21:41 +0200 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id s6B9LfLc007016; Fri, 11 Jul 2014 11:21:41 +0200 From: Keven Boell To: gdb-patches@sourceware.org Cc: keven.boell@intel.com, sanimir.agovic@intel.com Subject: [V2 06/23] vla: reconstruct value to compute bounds of target type Date: Fri, 11 Jul 2014 09:22:00 -0000 Message-Id: <1405070495-6948-7-git-send-email-keven.boell@intel.com> In-Reply-To: <1405070495-6948-1-git-send-email-keven.boell@intel.com> References: <1405070495-6948-1-git-send-email-keven.boell@intel.com> X-SW-Source: 2014-07/txt/msg00244.txt.bz2 Printing a pointer to an array, gdb tries to print the target type including its bounds. To follow this semantic with vla, this patch re-constructs the value to resolve the bounds of the target type. 2014-05-28 Sanimir Agovic Keven Boell * typeprint.c (whatis_exp): Re-construct value to compute bounds of target type. * c-valprint.c (c_value_print): Re-construct value to compute bounds of target type. Change-Id: Ia8a25021c7cc206711ca6f359ae5566a367e3b3d Signed-off-by: Keven Boell --- gdb/c-valprint.c | 11 ++++++++++- gdb/typeprint.c | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index f4694b0..8c45276 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -538,7 +538,16 @@ c_value_print (struct value *val, struct ui_file *stream, { /* normal case */ fprintf_filtered (stream, "("); - type_print (value_type (val), "", stream, -1); + if (is_dynamic_type (TYPE_TARGET_TYPE (type))) + { + struct value *v; + + v = value_ind (val); + v = value_addr (v); + type_print (value_type (v), "", stream, -1); + } + else + type_print (value_type (val), "", stream, -1); fprintf_filtered (stream, ") "); } } diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 026f3a2..4c861ac 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -459,6 +459,13 @@ whatis_exp (char *exp, int show) type = value_type (val); + if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (is_dynamic_type (TYPE_TARGET_TYPE (type))) + { + val = value_addr (value_ind (val)); + type = value_type (val); + } + get_user_print_options (&opts); if (opts.objectprint) { -- 1.7.9.5