From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29378 invoked by alias); 11 Jul 2014 09:21:45 -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 29142 invoked by uid 89); 11 Jul 2014 09:21:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Jul 2014 09:21:42 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 11 Jul 2014 02:21:42 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.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 s6B9LdQl020715; 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 s6B9Le9t007013; Fri, 11 Jul 2014 11:21:40 +0200 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id s6B9Le93007012; Fri, 11 Jul 2014 11:21:40 +0200 From: Keven Boell To: gdb-patches@sourceware.org Cc: keven.boell@intel.com, sanimir.agovic@intel.com Subject: [V2 05/23] vla: make field selection work with vla Date: Fri, 11 Jul 2014 09:21:00 -0000 Message-Id: <1405070495-6948-6-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/msg00235.txt.bz2 In Fortran vla are pointers to arrays. Thus a type only contains a pointer to such array and we need to re-read the field to retrieve the correct vla. old (wrong value): (gdb) p type_var%vla(14) $1 = 1 new (correct value): (gdb) p type_var%vla(14) $1 = 42 2014-05-28 Sanimir Agovic Keven Boell * value.c (value_primitive_field): Re-evaluate field value to get the actual value. Change-Id: Ic22c37324963aca520c52a80fbbd0042d1fddc05 Signed-off-by: Keven Boell --- gdb/value.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 1d514a5..ff5df8d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2970,13 +2970,22 @@ value_primitive_field (struct value *arg1, int offset, v = allocate_value_lazy (type); else { - v = allocate_value (type); - value_contents_copy_raw (v, value_embedded_offset (v), - arg1, value_embedded_offset (arg1) + offset, - TYPE_LENGTH (type)); + if (TYPE_DATA_LOCATION (type) + && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) + v = value_at_lazy (type, value_address (arg1) + offset); + else + { + v = allocate_value (type); + value_contents_copy_raw (v, value_embedded_offset (v), + arg1, value_embedded_offset (arg1) + offset, + TYPE_LENGTH (type)); + } } - v->offset = (value_offset (arg1) + offset - + value_embedded_offset (arg1)); + + if (!TYPE_DATA_LOCATION (type) + || !TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) + v->offset = (value_offset (arg1) + offset + + value_embedded_offset (arg1)); } set_value_component_location (v, arg1); VALUE_REGNUM (v) = VALUE_REGNUM (arg1); -- 1.7.9.5