From patchwork Thu Apr 10 12:40:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Agovic, Sanimir" X-Patchwork-Id: 481 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 6192036005B for ; Thu, 10 Apr 2014 05:48:41 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id 21B1440F87158; Thu, 10 Apr 2014 05:48:41 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx20.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id EFA994100B31C for ; Thu, 10 Apr 2014 05:48:40 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=S701olBcmqZiMOqBJ0PhO6E4gdhUod5 429mXmzEi3BKBSCTbYQF+X8Xgmtzm2jPFvUVt5N6/VjLXQmRSKY+MQV32ix4EQ5w efFNScqSMbfxn5Zr++bb0XLAdv5yTHzmwh9o5ixRRGS6t49S3UCqL9GrgfA9WVM9 7IpROwUzk0To= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=L0q7eODgmw+2YVEYgLdckKVGatw=; b=eVMhz ta2EJDpcAnmv0KKfbCeUZYO5ok84J2GKN7JVdGwMpHtDVGlnoNUyZgby6r/UKdg2 BVlW1vgYc896uogm6R8C2dygihBtEkTyLVeYKhEC0lt7xVwaPJI/WQl5DAAZ8nsA yk9HPE+4d8VdLgP16h4DKlmNBoq7PIdC6ClZ9w= Received: (qmail 31556 invoked by alias); 10 Apr 2014 12:48:39 -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 31546 invoked by uid 89); 10 Apr 2014 12:48:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Apr 2014 12:48:37 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 10 Apr 2014 05:43:51 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 10 Apr 2014 05:48:34 -0700 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [172.28.50.125]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s3AClnMB010146; Thu, 10 Apr 2014 13:47:59 +0100 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [127.0.0.1]) by ulliclel004.iul.intel.com (8.13.8/8.12.8/MailSET/client) with ESMTP id s3ACkwdO026773; Thu, 10 Apr 2014 14:47:18 +0200 Received: (from sagovic@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id s3ACkrWK026772; Thu, 10 Apr 2014 14:46:53 +0200 From: Sanimir Agovic To: brobecker@adacore.com Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: [PATCH v6 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence Date: Thu, 10 Apr 2014 14:40:11 +0200 Message-Id: <1397133617-26681-10-git-send-email-sanimir.agovic@intel.com> In-Reply-To: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com> References: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in A variable location might be a constant value and therefore no inferior memory access is needed to read the content. In this case try to resolve the type bounds. 2013-11-26 Sanimir Agovic Keven Boell * findvar.c (default_read_var_value): Resolve dynamic bounds if location points to a constant blob. Signed-off-by: Sanimir Agovic --- gdb/findvar.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/findvar.c b/gdb/findvar.c index ec6afd6..d54637c 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -441,7 +441,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) switch (SYMBOL_CLASS (var)) { case LOC_CONST: - /* Put the constant back in target format. */ + if (is_dynamic_type (type)) + /* Value is a constant byte-sequence and needs no memory access. */ + type = resolve_dynamic_type (type, /* Unused address. */ 0); + /* Put the constant back in target format. */ v = allocate_value (type); store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type), gdbarch_byte_order (get_type_arch (type)), @@ -468,6 +471,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) return v; case LOC_CONST_BYTES: + if (is_dynamic_type (type)) + /* Value is a constant byte-sequence and needs no memory access. */ + type = resolve_dynamic_type (type, /* Unused address. */ 0); v = allocate_value (type); memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), TYPE_LENGTH (type));