From patchwork Mon Mar 6 16:00:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 19435 Received: (qmail 97936 invoked by alias); 6 Mar 2017 16:02:31 -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 97911 invoked by uid 89); 6 Mar 2017 16:02:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=2838, 2636 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Mar 2017 16:02:30 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v26FrdCX106890 for ; Mon, 6 Mar 2017 11:02:29 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2917jkagyu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 06 Mar 2017 11:02:29 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Mar 2017 16:02:27 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 6 Mar 2017 16:02:24 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 915591B0804B for ; Mon, 6 Mar 2017 16:05:28 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v26G2NbS8585718 for ; Mon, 6 Mar 2017 16:02:23 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3FAC42045 for ; Mon, 6 Mar 2017 16:02:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D53642047 for ; Mon, 6 Mar 2017 16:02:17 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.222]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Mon, 6 Mar 2017 16:02:17 +0000 (GMT) From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 2/3] Test case for dump/restore of large array Date: Mon, 6 Mar 2017 17:00:19 +0100 In-Reply-To: <1488816060-20776-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1488816060-20776-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030616-0020-0000-0000-00000281B46F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030616-0021-0000-0000-00001F9E4350 Message-Id: <1488816060-20776-3-git-send-email-arnez@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-06_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703060134 X-IsSubscribed: yes This adds a test case to dump.exp that dumps and restores a large array. In particular it verifies that the dump and restore operations are completed in reasonable time. gdb/testsuite/ChangeLog: PR gdb/21220 * gdb.base/dump.c (bigarray): New variable. (zero_all): Clear bigarray as well. (func, fill_bigarray, cmp_bigarray): New functions. (main): Call fill_bigarray. * gdb.base/dump.exp: Add test for dump/restore of a large array. --- gdb/testsuite/gdb.base/dump.c | 37 +++++++++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/dump.exp | 8 ++++++++ 2 files changed, 45 insertions(+) diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c index bdcafbf..fdeefa8 100644 --- a/gdb/testsuite/gdb.base/dump.c +++ b/gdb/testsuite/gdb.base/dump.c @@ -3,6 +3,9 @@ #define ARRSIZE 32 int intarray[ARRSIZE], intarray2[ARRSIZE]; +#define BIGSIZE 16777216 +unsigned char bigarray[BIGSIZE]; + struct teststruct { int a; int b; @@ -25,6 +28,38 @@ zero_all () memset ((char *) &intarray2, 0, sizeof (intarray2)); memset ((char *) &intstruct, 0, sizeof (intstruct)); memset ((char *) &intstruct2, 0, sizeof (intstruct2)); + memset ((char *) &bigarray, 0, sizeof (bigarray)); +} + +static unsigned char +func (unsigned u) +{ + unsigned char a = u; + unsigned char b = (u >> 8); + unsigned char c = (u >> 16); + unsigned char d = (u >> 24); + + return (a ^ b ^ c ^ d); +} + +int +fill_bigarray () +{ + unsigned i; + + for (i = 0; i < sizeof (bigarray); i++) + bigarray[i] = func (i); +} + +int +cmp_bigarray () +{ + unsigned i; + + for (i = 0; i < sizeof (bigarray); i++) + if (bigarray[i] != func (i)) + return 0; + return 1; } int @@ -43,6 +78,8 @@ main() intstruct.f = 12 * 6; intstruct.g = 12 * 7; + fill_bigarray (); + checkpoint1 (); return 0; } diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index e67e1aa..170a09f 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -74,6 +74,7 @@ set all_files { intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intstr2.verilog intarr3.srec + bigarr1.bin } # This loop sets variables dynamically -- each name listed in @@ -263,6 +264,9 @@ make_dump_file \ "dump srec mem [set intarr3.srec] &intarray \(char *\) &intarray + sizeof intarray" \ "dump array as mem, srec, expressions" +make_dump_file "dump bin mem [set bigarr1.bin] &bigarray &bigarray\[sizeof bigarray\]" \ + "dump big array as memory, default" + proc test_restore_saved_value { restore_args msg oldval newval } { global gdb_prompt @@ -348,6 +352,10 @@ test_restore_saved_value "[set intstr2.bin] binary $struct_start" \ "struct as memory, binary" \ $struct_val "intstruct" +test_restore_saved_value "[set bigarr1.bin] binary &bigarray" \ + "reload big array as memory, binary" \ + 1 "cmp_bigarray ()" + # test restore with offset. set array2_start [capture_value "/x &intarray2\[0\]"]