From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50684 invoked by alias); 13 Mar 2017 19:51:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50672 invoked by uid 89); 13 Mar 2017 19:51:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:sk:1488816, 788 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Mar 2017 19:51:06 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3D29C81201; Mon, 13 Mar 2017 19:51:07 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2DJp5VA025209; Mon, 13 Mar 2017 15:51:06 -0400 Subject: Re: [PATCH 2/3] Test case for dump/restore of large array To: Andreas Arnez , gdb-patches@sourceware.org References: <1488816060-20776-1-git-send-email-arnez@linux.vnet.ibm.com> <1488816060-20776-3-git-send-email-arnez@linux.vnet.ibm.com> From: Pedro Alves Message-ID: <469ea9ec-2611-a065-16ff-556f4aca8f11@redhat.com> Date: Mon, 13 Mar 2017 19:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1488816060-20776-3-git-send-email-arnez@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-03/txt/msg00200.txt.bz2 On 03/06/2017 04:00 PM, Andreas Arnez wrote: > 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. It sounds like this will make the testcase unusable with many small embedded targets, while it would be before, because the target simply may not have enough memory for such a big array. Does that sound right? If so, then this calls for something like either splitting this particular test to a separate testcase, or do condition compilation attempting with and without the big buffer. > > 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\]"] Thanks, Pedro Alves