From patchwork Thu Apr 10 12:40:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Agovic, Sanimir" X-Patchwork-Id: 484 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 48B8036005B for ; Thu, 10 Apr 2014 05:51:03 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id 520B94824187; Thu, 10 Apr 2014 05:51:00 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.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-mx22.g.dreamhost.com (Postfix) with ESMTPS id A86FC47A04BB for ; Thu, 10 Apr 2014 05:50:59 -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=hoF5aBEhK1nCY41wSP89UsXPvw3lLgX qC3xez78/XZR1aAuXfB11spoceXwcpmHeDkB+9Wlwb5nPEmxWgEkn66YmpZ2ux/L d1/XwGH3vOTVRRBMXTWVWrKYlvdShQXO+cLgJnCYQZvetb1YZGdFLffpxEbXAlwH 5pGsPedNed1c= 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=LGGAIQcOcKWHF8sYDt1J6nnLFGo=; b=lHyik cjXpjKwz6kXDi5eAXkuUImpNysd5SlOJBS0VNr6rjKdmFhMLXUOegfEDLiUhNiGZ diNk/4HMP0o4V6Ti3LINFE711A73V1RS4TzW6ngXmCdX4Ayv1MiZOONjXXzMzeKE uGmwTfJkkXVkQtWLg62MdsT1LRSU6y+m3f7cig= Received: (qmail 3271 invoked by alias); 10 Apr 2014 12:50:57 -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 3260 invoked by uid 89); 10 Apr 2014 12:50:57 -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; Thu, 10 Apr 2014 12:50:56 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 10 Apr 2014 05:50:31 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 10 Apr 2014 05:50:30 -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 s3ACoEWB011631; Thu, 10 Apr 2014 13:50:19 +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 s3ACnDqc026788; Thu, 10 Apr 2014 14:49:33 +0200 Received: (from sagovic@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id s3ACn7xP026787; Thu, 10 Apr 2014 14:49:07 +0200 From: Sanimir Agovic To: brobecker@adacore.com Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: [PATCH v6 12/15] test: multi-dimensional c99 vla. Date: Thu, 10 Apr 2014 14:40:14 +0200 Message-Id: <1397133617-26681-13-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 2013-10-18 Keven Boell Sanimir Agovic gdb/testsuite: * gdb.base/vla-multi.c: New file. * gdb.base/vla-multi.exp: New file. Signed-off-by: Sanimir Agovic --- gdb/testsuite/gdb.base/vla-multi.c | 48 ++++++++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/vla-multi.exp | 41 ++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 gdb/testsuite/gdb.base/vla-multi.c create mode 100644 gdb/testsuite/gdb.base/vla-multi.exp diff --git a/gdb/testsuite/gdb.base/vla-multi.c b/gdb/testsuite/gdb.base/vla-multi.c new file mode 100644 index 0000000..e5bf9e2 --- /dev/null +++ b/gdb/testsuite/gdb.base/vla-multi.c @@ -0,0 +1,48 @@ +/* This testcase is part of GDB, the GNU debugger. + + 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 . */ + +void +f1 (int n, int m, int vla_ptr[n][m]) +{ + return; /* f1_breakpoint */ +} + +void +vla_mult (int n, int m) +{ + int vla[n][m]; + int i, j; + + for (i = 0; i < n; i++) + { + for (j = 0; j < m; j++) + { + vla[i][j] = i + j; + } + } + + f1(n, m, vla); /* vla_filled */ + + return; +} + +int +main(void) +{ + vla_mult(2, 2); + return 0; +} diff --git a/gdb/testsuite/gdb.base/vla-multi.exp b/gdb/testsuite/gdb.base/vla-multi.exp new file mode 100644 index 0000000..afc2b61 --- /dev/null +++ b/gdb/testsuite/gdb.base/vla-multi.exp @@ -0,0 +1,41 @@ +# 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 . + +standard_testfile + +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +set sizeof_int [get_sizeof "int" 4] + +gdb_breakpoint [gdb_get_line_number "vla_filled"] +gdb_continue_to_breakpoint "vla_filled" +gdb_test "print vla" " = \\\{\\\{0, 1\\\}, \\\{1, 2\\\}\\\}" \ + "print vla" +gdb_test "print vla\[0\]\[1\]" " = 1" "print vla\[0\]\[1\]" + +gdb_breakpoint [gdb_get_line_number "f1_breakpoint"] +gdb_continue_to_breakpoint "f1_breakpoint" + +# Calculate the overall size of the vla. +set sizeof_vla [ expr "2" * "$sizeof_int" ] +gdb_test "ptype &vla_ptr" \ + "type = int \\\(\\\*\\\*\\\)\\\[variable length\\\]" \ + "ptype &vla_ptr"