From patchwork Mon Apr 28 20:09:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 738 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 C2EE3360060 for ; Mon, 28 Apr 2014 13:09:55 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id 7DBAD41571A74; Mon, 28 Apr 2014 13:09:55 -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 5AA5E414FDC35 for ; Mon, 28 Apr 2014 13:09:55 -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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Y8YLxx+mGhj19KLiENmiARXcL0v4ftE 0As/s2WixFEqx2AZDRDaZXA9ptpPsANgk9lSDu/bnGdLZDpL9yZpIx0fObb2NgXv 8ggnPAFAuEeiwqJfyxdyom9OuHQM7Wkbcyy5kk+y1rMhzP1mpzuKWWJiai1deE7y i4dof5KiYngg= 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:subject:date:message-id:in-reply-to :references; s=default; bh=Ft+qrIqjDz6IcGu702OKSa7H87k=; b=nY8m3 d8Oq3f+ly+5aVEiKAkkCs/c+KAv6kO/Zx1qD/JW4ZaR3sAM5jbyS4PFkNC1y32Qk VB7//PMoyhHHB6drJO4MQpR7c4XK62n7v/fcsx/pvWS/AqrRaySqVC7RekbVgqPr B/cg1VyAzHu+BqUZeosfso9ddhDbgmNerX0CEA= Received: (qmail 21773 invoked by alias); 28 Apr 2014 20:09: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 21625 invoked by uid 89); 28 Apr 2014 20:09:49 -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, SPF_PASS autolearn=ham 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, 28 Apr 2014 20:09:47 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E68E4116166 for ; Mon, 28 Apr 2014 16:09:45 -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 WcKc+9NlkBBI for ; Mon, 28 Apr 2014 16:09:45 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CEFE511615D for ; Mon, 28 Apr 2014 16:09:45 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id B2070E0487; Mon, 28 Apr 2014 16:09:45 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [pushed 4/4] Add gdb.ada/dyn_arrayidx testcase. Date: Mon, 28 Apr 2014 16:09:24 -0400 Message-Id: <1398715764-1548-5-git-send-email-brobecker@adacore.com> In-Reply-To: <1398715764-1548-1-git-send-email-brobecker@adacore.com> References: <1398715764-1548-1-git-send-email-brobecker@adacore.com> X-DH-Original-To: gdb@patchwork.siddhesh.in This add a testcases that verifies correct handling of dynamicity for lower bounds of arrays. gdb/testsuite/ChangeLog: * gdb.ada/dyn_arrayidx: New testcase. Tested on x86_64-linux, pushed. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.ada/dyn_arrayidx.exp | 36 ++++++++++++++++++++++++++++++ gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb | 32 ++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 gdb/testsuite/gdb.ada/dyn_arrayidx.exp create mode 100644 gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5bb89a2..8078a42 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-04-28 Joel Brobecker + + * gdb.ada/dyn_arrayidx: New testcase. + 2014-04-26 Yao Qi * gdb.dwarf2/dwz.exp: Compile main.c to object. Restart GDB diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx.exp b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp new file mode 100644 index 0000000..04c39b0 --- /dev/null +++ b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp @@ -0,0 +1,36 @@ +# Copyright 2014 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib "ada.exp" + +if { [skip_ada_tests] } { return -1 } + +standard_ada_testfile foo + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 +} + +clean_restart ${testfile} + +set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb] +runto "foo.adb:$bp_location" + +# Make sure we do not use any of the descriptive types, even if +# the compiler generated them. +gdb_test_no_output "maintenance set ada ignore-descriptive-types" + +gdb_test "ptype array_type" \ + " = array \\(5 \\.\\. 10\\) of natural" \ diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb new file mode 100644 index 0000000..4deb04d --- /dev/null +++ b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb @@ -0,0 +1,32 @@ +-- Copyright 2014 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +procedure Foo is + function Range_Count (L, U : Integer) return Natural + is + type Array_Type is array (L .. U) of Natural; + A : Array_Type := (others => 1); + Result : Natural := 0; + begin + for I of A loop -- START + Result := Result + I; + end loop; + return Result; + end Range_Count; + + R2 : constant Natural := Range_Count (5, 10); +begin + null; +end Foo;