From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A7E0F3858D28 for ; Wed, 15 Dec 2021 15:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7E0F3858D28 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-uFuscNabOFCuC4BlRya7qw-1; Wed, 15 Dec 2021 10:33:17 -0500 X-MC-Unique: uFuscNabOFCuC4BlRya7qw-1 Received: by mail-wm1-f71.google.com with SMTP id i15-20020a05600c354f00b0034566ac865bso938039wmq.6 for ; Wed, 15 Dec 2021 07:33:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PopH37FkzKDai223HExnFO0hZ44PyS0ThMIiUBUxoQ8=; b=HHMEzaJjBQQ+Uoq/8LU0qAPiPb3rdYNTsLBxJM1a7OPnaOXIsdyFoZjr1wj8ddY4CE upvU46bDSa0glK9fCIPSb331wOYKr0ya7uAfxiCFGLtXMEAVrKUH+1xQoAqXfrkCMote jzoRfDfBapBTFDjUnWvwp2Caan+MkCSRGhaZF3njpyZkpsq9wuk0fxNp9YpcYzVSwCKS r5GDovDuKTyQgAaj6+MyInI9ikgMTIOvSLBLOHKMRaWob+/cdHHjAUYMzMI82qgZDrm+ //K0Mbendez4QalyYSMhUnlfbDPbp/hgiWDdZwKKcnPFsGe8Yy6VZK2bKoeQl+6vQRoi IPEA== X-Gm-Message-State: AOAM530YwuN89GGCXAh5JqIZCfY9XKpH/l2wmP4F3FzHIe2Ue3QEUiuZ giIq4FeEjjhk644rkqpTLCVfMqk0TNpd7JkLpiDnC4JU9p0vbbc0PV+lcWcyAC3Gl5xmMpBEEkl QPIK5IEj+3SHFtVrauzX/fg== X-Received: by 2002:a1c:4406:: with SMTP id r6mr347259wma.42.1639582395583; Wed, 15 Dec 2021 07:33:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzrsT6eIurIx9p0syyBIIEVFlLAGIhtPsXQfn90A037Tn5eLJdGnhVfvs96rLn1+ThH36r3w== X-Received: by 2002:a1c:4406:: with SMTP id r6mr347230wma.42.1639582395170; Wed, 15 Dec 2021 07:33:15 -0800 (PST) Received: from localhost (host86-134-238-138.range86-134.btcentralplus.com. [86.134.238.138]) by smtp.gmail.com with ESMTPSA id m6sm3114657wrp.34.2021.12.15.07.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 07:33:14 -0800 (PST) Date: Wed, 15 Dec 2021 15:33:13 +0000 From: Andrew Burgess To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 4/6] Add `set print repeats' tests for C/C++ arrays Message-ID: <20211215153313.GL175541@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 15:23:52 up 3 days, 1:41, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Dec 2021 15:33:23 -0000 * Maciej W. Rozycki [2021-12-11 11:47:34 +0000]: > Add `set print repeats' tests for C/C++ arrays, complementing one for > Fortran arrays and covering the different interpretation of the `set > print elements' setting in particular where the per-dimension count of > the elements handled is matched against the trigger rather than the > total element count as with Fortran arrays. I know we disagree on this topic, but I would, one day, like to see the C/C++ array printing behave as the Fortran array printing does, as that makes much more sense to me. But, adding tests for GDB's current behaviour is definitely a good thing, so I'm happy to see this going in, with one change... Given that the C and C++ tests are almost identical, I think you should consider just adding one copy in gdb.base and compiling it as both C and C++. For inspiration you can look at these files: gdb/testsuite/gdb.base/infcall-nested-structs-c.exp gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl Thanks, Andrew > --- > gdb/testsuite/gdb.base/array-repeat.c | 63 ++++++++++++++ > gdb/testsuite/gdb.base/array-repeat.exp | 137 +++++++++++++++++++++++++++++++ > gdb/testsuite/gdb.cp/array-repeat.cc | 64 ++++++++++++++ > gdb/testsuite/gdb.cp/array-repeat.exp | 139 ++++++++++++++++++++++++++++++++ > 4 files changed, 403 insertions(+) > create mode 100644 gdb/testsuite/gdb.fortran/array-repeat.exp > create mode 100644 gdb/testsuite/gdb.fortran/array-repeat.f90 > > gdb-set-print-repeats-test.diff > Index: src/gdb/testsuite/gdb.base/array-repeat.c > =================================================================== > --- /dev/null > +++ src/gdb/testsuite/gdb.base/array-repeat.c > @@ -0,0 +1,63 @@ > +/* Copyright 2021 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 . */ > + > +#include > + > +int > +main (void) > +{ > + int array_1d[5]; > + int array_1d9[6]; > + int array_2d[5][5]; > + int array_2d9[6][6]; > + int array_3d[5][5][5]; > + int array_3d9[6][6][6]; > + int i; > + > + for (i = 0; i < sizeof (array_1d) / sizeof (int); i++) > + *(array_1d + i) = 1; > + for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++) > + *(array_1d9 + i) = i % 6 == 5 ? 9 : 1; > + for (i = 0; i < sizeof (array_2d) / sizeof (int); i++) > + *(*array_2d + i) = 2; > + for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++) > + *(*array_2d9 + i) = i / 6 == 5 || i % 6 == 5 ? 9 : 2; > + for (i = 0; i < sizeof (array_3d) / sizeof (int); i++) > + *(**array_3d + i) = 3; > + for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++) > + *(**array_3d9 + i) = i / 6 / 6 == 5 || i / 6 % 6 == 5 || i % 6 == 5 ? 9 : 3; > + > + printf("\n"); /* Break here */ > + for (i = 0; i < sizeof (array_1d) / sizeof (int); i++) > + printf(" %d", *(array_1d + i)); > + printf("\n"); > + for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++) > + printf(" %d", *(array_1d9 + i)); > + printf("\n"); > + for (i = 0; i < sizeof (array_2d) / sizeof (int); i++) > + printf(" %d", *(*array_2d + i)); > + printf("\n"); > + for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++) > + printf(" %d", *(*array_2d9 + i)); > + printf("\n"); > + for (i = 0; i < sizeof (array_3d) / sizeof (int); i++) > + printf(" %d", *(**array_3d + i)); > + printf("\n"); > + for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++) > + printf(" %d", *(**array_3d9 + i)); > + printf("\n"); > + > + return 0; > +} > Index: src/gdb/testsuite/gdb.base/array-repeat.exp > =================================================================== > --- /dev/null > +++ src/gdb/testsuite/gdb.base/array-repeat.exp > @@ -0,0 +1,137 @@ > +# Copyright 2021 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 . > + > +# Test the detection and printing of repeated elements in C arrays. > + > +standard_testfile .c > + > +if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug}]} { > + return -1 > +} > + > +if {![runto_main]} { > + perror "Could not run to main." > + continue > +} > + > +gdb_breakpoint [gdb_get_line_number "Break here"] > +gdb_continue_to_breakpoint "Break here" > + > +# Build up the expected output for each array. > +set a9p9o "{9, 9, 9, 9, 9, 9}" > +set a1p "{1, 1, 1, 1, 1}" > +set a1p9 "{1, 1, 1, 1, 1, 9}" > +set a2po "{2, 2, 2, 2, 2}" > +set a2p "{${a2po}, ${a2po}, ${a2po}, ${a2po}, ${a2po}}" > +set a2p9o "{2, 2, 2, 2, 2, 9}" > +set a2p9 "{${a2p9o}, ${a2p9o}, ${a2p9o}, ${a2p9o}, ${a2p9o}, ${a9p9o}}" > +set a3po "{3, 3, 3, 3, 3}" > +set a3p "{${a3po}, ${a3po}, ${a3po}, ${a3po}, ${a3po}}" > +set a3p "{${a3p}, ${a3p}, ${a3p}, ${a3p}, ${a3p}}" > +set a3p9o "{3, 3, 3, 3, 3, 9}" > +set a3p9 "{${a3p9o}, ${a3p9o}, ${a3p9o}, ${a3p9o}, ${a3p9o}, ${a9p9o}}" > +set a9p9 "{${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}}" > +set a3p9 "{${a3p9}, ${a3p9}, ${a3p9}, ${a3p9}, ${a3p9}, ${a9p9}}" > + > +# Convert the output into a regexp. > +set r1p [string_to_regexp $a1p] > +set r1p9 [string_to_regexp $a1p9] > +set r2po [string_to_regexp $a2po] > +set r2p9o [string_to_regexp $a2p9o] > +set r2p [string_to_regexp $a2p] > +set r2p9 [string_to_regexp $a2p9] > +set r3po [string_to_regexp $a3po] > +set r3p9o [string_to_regexp $a3p9o] > +set r3p [string_to_regexp $a3p] > +set r3p9 [string_to_regexp $a3p9] > + > +set rep5 "" > +set rep6 "" > + > +with_test_prefix "repeats=unlimited, elements=unlimited" { > + # Check the arrays print as expected. > + gdb_test_no_output "set print repeats unlimited" > + gdb_test_no_output "set print elements unlimited" > + > + gdb_test "print array_1d" "${r1p}" > + gdb_test "print array_1d9" "${r1p9}" > + gdb_test "print array_2d" "${r2p}" > + gdb_test "print array_2d9" "${r2p9}" > + gdb_test "print array_3d" "${r3p}" > + gdb_test "print array_3d9" "${r3p9}" > +} > + > +with_test_prefix "repeats=4, elements=unlimited" { > + # Now set the repeat limit. > + gdb_test_no_output "set print repeats 4" > + gdb_test_no_output "set print elements unlimited" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1 ${rep5}}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1 ${rep5}, 9}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2 ${rep5}} ${rep5}}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2 ${rep5}, 9} ${rep5}, {9 ${rep6}}}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3 ${rep5}} ${rep5}} ${rep5}}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3 ${rep5}, 9} ${rep5}, {9 ${rep6}}} ${rep5},\ > + {{9 ${rep6}} ${rep6}}}"] > +} > + > +with_test_prefix "repeats=unlimited, elements=3" { > + # Now set the element limit. > + gdb_test_no_output "set print repeats unlimited" > + gdb_test_no_output "set print elements 3" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1, 1, 1...}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1, 1, 1...}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2, 2, 2...}, {2, 2, 2...}, {2, 2, 2...}...}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2, 2, 2...}, {2, 2, 2...}, {2, 2, 2...}...}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...}...}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...}...}"] > +} > + > +with_test_prefix "repeats=4, elements=12" { > + # Now set both limits. > + gdb_test_no_output "set print repeats 4" > + gdb_test_no_output "set print elements 12" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1 ${rep5}}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1 ${rep5}, 9}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2 ${rep5}} ${rep5}}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2 ${rep5}, 9} ${rep5}, {9 ${rep6}}}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3 ${rep5}} ${rep5}} ${rep5}}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3 ${rep5}, 9} ${rep5}, {9 ${rep6}}} ${rep5},\ > + {{9 ${rep6}} ${rep6}}}"] > +} > Index: src/gdb/testsuite/gdb.cp/array-repeat.cc > =================================================================== > --- /dev/null > +++ src/gdb/testsuite/gdb.cp/array-repeat.cc > @@ -0,0 +1,64 @@ > +// Copyright 2021 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 . > + > +#include > +#include > + > +int > +main () > +{ > + int array_1d[5]; > + int array_1d9[6]; > + int array_2d[5][5]; > + int array_2d9[6][6]; > + int array_3d[5][5][5]; > + int array_3d9[6][6][6]; > + std::size_t i; > + > + for (i = 0; i < sizeof (array_1d) / sizeof (int); i++) > + *(array_1d + i) = 1; > + for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++) > + *(array_1d9 + i) = i % 6 == 5 ? 9 : 1; > + for (i = 0; i < sizeof (array_2d) / sizeof (int); i++) > + *(*array_2d + i) = 2; > + for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++) > + *(*array_2d9 + i) = i / 6 == 5 || i % 6 == 5 ? 9 : 2; > + for (i = 0; i < sizeof (array_3d) / sizeof (int); i++) > + *(**array_3d + i) = 3; > + for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++) > + *(**array_3d9 + i) = i / 6 / 6 == 5 || i / 6 % 6 == 5 || i % 6 == 5 ? 9 : 3; > + > + std::cout << "\n"; // Break here > + for (i = 0; i < sizeof (array_1d) / sizeof (int); i++) > + std::cout << " " << *(array_1d + i); > + std::cout << "\n"; > + for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++) > + std::cout << " " << *(array_1d9 + i); > + std::cout << "\n"; > + for (i = 0; i < sizeof (array_2d) / sizeof (int); i++) > + std::cout << " " << *(*array_2d + i); > + std::cout << "\n"; > + for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++) > + std::cout << " " << *(*array_2d9 + i); > + std::cout << "\n"; > + for (i = 0; i < sizeof (array_3d) / sizeof (int); i++) > + std::cout << " " << *(**array_3d + i); > + std::cout << "\n"; > + for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++) > + std::cout << " " << *(**array_3d9 + i); > + std::cout << "\n"; > + > + return 0; > +} > Index: src/gdb/testsuite/gdb.cp/array-repeat.exp > =================================================================== > --- /dev/null > +++ src/gdb/testsuite/gdb.cp/array-repeat.exp > @@ -0,0 +1,139 @@ > +# Copyright 2021 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 . > + > +# Test the detection and printing of repeated elements in C++ arrays. > + > +if {[skip_cplus_tests]} { continue } > + > +standard_testfile .cc > + > +if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}]} { > + return -1 > +} > + > +if {![runto_main]} { > + perror "Could not run to main." > + continue > +} > + > +gdb_breakpoint [gdb_get_line_number "Break here"] > +gdb_continue_to_breakpoint "Break here" > + > +# Build up the expected output for each array. > +set a9p9o "{9, 9, 9, 9, 9, 9}" > +set a1p "{1, 1, 1, 1, 1}" > +set a1p9 "{1, 1, 1, 1, 1, 9}" > +set a2po "{2, 2, 2, 2, 2}" > +set a2p "{${a2po}, ${a2po}, ${a2po}, ${a2po}, ${a2po}}" > +set a2p9o "{2, 2, 2, 2, 2, 9}" > +set a2p9 "{${a2p9o}, ${a2p9o}, ${a2p9o}, ${a2p9o}, ${a2p9o}, ${a9p9o}}" > +set a3po "{3, 3, 3, 3, 3}" > +set a3p "{${a3po}, ${a3po}, ${a3po}, ${a3po}, ${a3po}}" > +set a3p "{${a3p}, ${a3p}, ${a3p}, ${a3p}, ${a3p}}" > +set a3p9o "{3, 3, 3, 3, 3, 9}" > +set a3p9 "{${a3p9o}, ${a3p9o}, ${a3p9o}, ${a3p9o}, ${a3p9o}, ${a9p9o}}" > +set a9p9 "{${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}, ${a9p9o}}" > +set a3p9 "{${a3p9}, ${a3p9}, ${a3p9}, ${a3p9}, ${a3p9}, ${a9p9}}" > + > +# Convert the output into a regexp. > +set r1p [string_to_regexp $a1p] > +set r1p9 [string_to_regexp $a1p9] > +set r2po [string_to_regexp $a2po] > +set r2p9o [string_to_regexp $a2p9o] > +set r2p [string_to_regexp $a2p] > +set r2p9 [string_to_regexp $a2p9] > +set r3po [string_to_regexp $a3po] > +set r3p9o [string_to_regexp $a3p9o] > +set r3p [string_to_regexp $a3p] > +set r3p9 [string_to_regexp $a3p9] > + > +set rep5 "" > +set rep6 "" > + > +with_test_prefix "repeats=unlimited, elements=unlimited" { > + # Check the arrays print as expected. > + gdb_test_no_output "set print repeats unlimited" > + gdb_test_no_output "set print elements unlimited" > + > + gdb_test "print array_1d" "${r1p}" > + gdb_test "print array_1d9" "${r1p9}" > + gdb_test "print array_2d" "${r2p}" > + gdb_test "print array_2d9" "${r2p9}" > + gdb_test "print array_3d" "${r3p}" > + gdb_test "print array_3d9" "${r3p9}" > +} > + > +with_test_prefix "repeats=4, elements=unlimited" { > + # Now set the repeat limit. > + gdb_test_no_output "set print repeats 4" > + gdb_test_no_output "set print elements unlimited" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1 ${rep5}}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1 ${rep5}, 9}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2 ${rep5}} ${rep5}}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2 ${rep5}, 9} ${rep5}, {9 ${rep6}}}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3 ${rep5}} ${rep5}} ${rep5}}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3 ${rep5}, 9} ${rep5}, {9 ${rep6}}} ${rep5},\ > + {{9 ${rep6}} ${rep6}}}"] > +} > + > +with_test_prefix "repeats=unlimited, elements=3" { > + # Now set the element limit. > + gdb_test_no_output "set print repeats unlimited" > + gdb_test_no_output "set print elements 3" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1, 1, 1...}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1, 1, 1...}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2, 2, 2...}, {2, 2, 2...}, {2, 2, 2...}...}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2, 2, 2...}, {2, 2, 2...}, {2, 2, 2...}...}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...}...}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...},\ > + {{3, 3, 3...}, {3, 3, 3...}, {3, 3, 3...}...}...}"] > +} > + > +with_test_prefix "repeats=4, elements=12" { > + # Now set both limits. > + gdb_test_no_output "set print repeats 4" > + gdb_test_no_output "set print elements 12" > + > + gdb_test "print array_1d" \ > + [string_to_regexp "{1 ${rep5}}"] > + gdb_test "print array_1d9" \ > + [string_to_regexp "{1 ${rep5}, 9}"] > + gdb_test "print array_2d" \ > + [string_to_regexp "{{2 ${rep5}} ${rep5}}"] > + gdb_test "print array_2d9" \ > + [string_to_regexp "{{2 ${rep5}, 9} ${rep5}, {9 ${rep6}}}"] > + gdb_test "print array_3d" \ > + [string_to_regexp "{{{3 ${rep5}} ${rep5}} ${rep5}}"] > + gdb_test "print array_3d9" \ > + [string_to_regexp "{{{3 ${rep5}, 9} ${rep5}, {9 ${rep6}}} ${rep5},\ > + {{9 ${rep6}} ${rep6}}}"] > +} >