From patchwork Wed Jun 4 05:54:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keven Boell X-Patchwork-Id: 1282 Received: (qmail 26889 invoked by alias); 4 Jun 2014 05:54:38 -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 26789 invoked by uid 89); 4 Jun 2014 05:54:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 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; Wed, 04 Jun 2014 05:54:35 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 03 Jun 2014 22:54:34 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 03 Jun 2014 22:54:33 -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 s545sWDH020260; Wed, 4 Jun 2014 06:54:32 +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 s545sV5i006291; Wed, 4 Jun 2014 07:54:31 +0200 Received: (from kboell@localhost) by ullecvh004g04.iul.intel.com (8.13.8/8.13.8/Submit) id s545sVm6006290; Wed, 4 Jun 2014 07:54:31 +0200 From: Keven Boell To: gdb-patches@sourceware.org Cc: sanimir.agovic@intel.com, keven.boell@intel.com Subject: [PATCH 05/23] vla: make field selection work with vla Date: Wed, 4 Jun 2014 07:54:08 +0200 Message-Id: <1401861266-6240-6-git-send-email-keven.boell@intel.com> In-Reply-To: <1401861266-6240-1-git-send-email-keven.boell@intel.com> References: <1401861266-6240-1-git-send-email-keven.boell@intel.com> 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 08593b6..1f0d9a4 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2929,13 +2929,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);