From patchwork Mon Apr 14 17:13:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 544 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 51384360075 for ; Mon, 14 Apr 2014 10:14:24 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id 0991A413B4D7C; Mon, 14 Apr 2014 10:14:23 -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 C5AA04145337A for ; Mon, 14 Apr 2014 10:14:23 -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=T2146RL1Jfaj039YXUDKy/tcmHXR1Xu gdRzEMGF99qV5t+L+lzbS3Moz/BNMJLhD5GlTZ3UWWGkhv1hDzbR8JEhTB4AyhJT 1D6yk/l6NISdIxAZRejAteM3BKUSc3/DQpkzCe9Rfb4hvewR0q0xm32CfK9J+Tgl E1ibLOgAWRf8= 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=F0JI0Uzpc0SN+2Wo2+j7x3PxCs4=; b=kSF6f PSIeaaI2zKPhBqtyr02uLk4yV/iG7OERfffKhyGvDLIpwxeTq5styBIEtSq1GoBh pj9hZ3mgEHINJO5SbddJXBv8GbnnQNTs3zVGuVw2Ywpghw8kWsnMbuyeKDfaV8QQ wZ85g2vy4bvtgxWxx2YbXDqSON5LmyQBuUvBhw= Received: (qmail 8937 invoked by alias); 14 Apr 2014 17:13:50 -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 8843 invoked by uid 89); 14 Apr 2014 17:13:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 14 Apr 2014 17:13:48 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id ACCB01160DD; Mon, 14 Apr 2014 13:13:46 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sJa0G8iFjzuj; Mon, 14 Apr 2014 13:13:46 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 7930C1160DB; Mon, 14 Apr 2014 13:13:46 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 07020E02C0; Mon, 14 Apr 2014 10:13:52 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Sanimir Agovic Subject: [PATCH 07/12] vla: resolve dynamic bounds if value contents is a constant byte-sequence Date: Mon, 14 Apr 2014 10:13:11 -0700 Message-Id: <1397495596-25364-8-git-send-email-brobecker@adacore.com> In-Reply-To: <1397495596-25364-1-git-send-email-brobecker@adacore.com> References: <0377C58828D86C4588AEEC42FC3B85A71D8507B7@IRSMSX105.ger.corp.intel.com> <1397495596-25364-1-git-send-email-brobecker@adacore.com> X-DH-Original-To: gdb@patchwork.siddhesh.in From: Sanimir Agovic 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. gdb/ChangeLog: * findvar.c (default_read_var_value): Resolve dynamic bounds if location points to a constant blob. --- gdb/ChangeLog | 5 +++++ gdb/findvar.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 717c197..3ea7687 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2014-04-14 Sanimir Agovic + * findvar.c (default_read_var_value): Resolve dynamic bounds if location + points to a constant blob. + +2014-04-14 Sanimir Agovic + * dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic property and store it as the high bound and flag the range accordingly. * gdbtypes.c (resolve_dynamic_bounds): If range is flagged as diff --git a/gdb/findvar.c b/gdb/findvar.c index a2a7bb7..998a799 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -437,7 +437,12 @@ 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)), @@ -464,6 +469,11 @@ 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));