From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 487053953CF3 for ; Sat, 19 Sep 2020 08:54:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 487053953CF3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x332.google.com with SMTP id e11so8201830wme.0 for ; Sat, 19 Sep 2020 01:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=u/W6yg/tR1zSLt2NUMO8OotiyuT95UzK2AiYR0CdGp0=; b=KUdZDajmrgUzuLNKUoxWJtolu5A2ujXeSQb+UdEK/eVbjxhk8h2kKXyyqp5ItzH6Xs 2TFugTV03em7h9R3l05ZaPLHDDGKvMSSds8TAVbkGDonFQF0m9kc06Ts/npGfaGm1lLd 6cglhQPPOBn4KqqaDmKKPIoacYeTedpykXk9Ls8vzk87gstxpgcIlrFE9BBmdxS6RIg+ WiCt7kDBzoiGI+dtxnWjZVAGfzax1A7PPJdqzsbX9DvuZX59DBGF6f8erSiTb9jdTPl9 qrIFYI9IvWkk8Z/fwAs1MDZbjj9MQ3RzGUv9JGzpP0jJMxlNqU/Td7wJ84LTImawML+M V2SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=u/W6yg/tR1zSLt2NUMO8OotiyuT95UzK2AiYR0CdGp0=; b=pODR7SN74aU+wX9xNHqnWbCl/YVYl7rNJTVZQaLJ6l+MohFUO6zcIPAezly1ntrB/s 8tGwfmZ0gg7n8MhBNrWMd0IMvFpdlV3qc5LyQnXOnfrWr87303vcGBgCRON/SkGynGLj ycCcgKGJ6j8HcpdWq0LI/aSFX9dWC8Zgpgb5rxOlqoyx5ufLC+e/e2KX93uf1dDX7UDN dCGApSc2NiZfbjqhUEqUcBAPnXhu6mHNlrqJGT4u9kAxnrsqohA715SQHszI7dw7/U9R eTyPfCK4n9JFcVlw6sUgixpfnN6EGWfyJ/Ktde2kCK+/rl3CRB69T1EJrezLu8Cvj4Xq v4KA== X-Gm-Message-State: AOAM532akniFx27apWN4iM87gsonjy5pgnrwK99ynVdrMNQg1NUnrNxT rKGGhbBDKBF7+Bm/QHHydmkQ8RUf08yEgw== X-Google-Smtp-Source: ABdhPJyu+P5PnLfshnZ1bEuDmdoKXSKhMXRCdk6h4AWyrC0hLAsTaK0eUOU5pStmvxW/8taCP/5R5w== X-Received: by 2002:a1c:1d52:: with SMTP id d79mr20696367wmd.82.1600505656100; Sat, 19 Sep 2020 01:54:16 -0700 (PDT) Received: from localhost (host31-53-80-104.range31-53.btcentralplus.com. [31.53.80.104]) by smtp.gmail.com with ESMTPSA id t6sm11440019wre.30.2020.09.19.01.54.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2020 01:54:15 -0700 (PDT) Date: Sat, 19 Sep 2020 09:54:14 +0100 From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv2 07/10] gdb/fortran: Change whitespace when printing arrays Message-ID: <20200919085414.GF1540618@embecosm.com> References: <0c57969d384bed22ecb75568e92d5d0e305a7983.1598452395.git.andrew.burgess@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0c57969d384bed22ecb75568e92d5d0e305a7983.1598452395.git.andrew.burgess@embecosm.com> X-Operating-System: Linux/5.8.9-101.fc31.x86_64 (x86_64) X-Uptime: 09:54:00 up 17:01, 1 user, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sat, 19 Sep 2020 08:54:19 -0000 * Andrew Burgess [2020-08-26 15:49:14 +0100]: > This commit makes the whitespace usage when printing Fortran arrays > more consistent, and more inline with how we print C arrays. > > Currently a 2 dimensional Fotran array is printed like this, I find > the marked whitespace unpleasant: > > (( 1, 2, 3) ( 4, 5, 6) ) > ^ ^ ^ > > After this commit the same array is printed like this: > > ((1, 2, 3) (4, 5, 6)) > > Which seems more inline with how we print C arrays, in the case of C > arrays we don't add extra whitespace before the first element. > > gdb/ChangeLog: > > * f-valprint.c (f77_print_array_1): Adjust printing of whitespace > for arrays. > > gdb/testsuite/ChangeLog: > > * gdb.fortran/array-slices.exp: Update expected results. > * gdb.fortran/class-allocatable-array.exp: Likewise. > * gdb.fortran/multi-dim.exp: Likewise. > * gdb.fortran/vla-type.exp: Likewise. > * gdb.mi/mi-vla-fortran.exp: Likewise. I pushed this patch. Thanks, Andrew > --- > gdb/ChangeLog | 5 +++++ > gdb/f-valprint.c | 7 +++++-- > gdb/testsuite/ChangeLog | 8 ++++++++ > gdb/testsuite/gdb.fortran/array-slices.exp | 16 ++++++++-------- > .../gdb.fortran/class-allocatable-array.exp | 2 +- > gdb/testsuite/gdb.fortran/multi-dim.exp | 2 +- > gdb/testsuite/gdb.fortran/vla-type.exp | 6 +++--- > gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 2 +- > 8 files changed, 32 insertions(+), 16 deletions(-) > > diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c > index fabdf458616..3973984542c 100644 > --- a/gdb/f-valprint.c > +++ b/gdb/f-valprint.c > @@ -137,14 +137,17 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, > (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val) > + offs, addr + offs); > > - fprintf_filtered (stream, "( "); > + fprintf_filtered (stream, "("); > f77_print_array_1 (nss + 1, ndimensions, value_type (subarray), > value_contents_for_printing (subarray), > value_embedded_offset (subarray), > value_address (subarray), > stream, recurse, subarray, options, elts); > offs += byte_stride; > - fprintf_filtered (stream, ") "); > + fprintf_filtered (stream, ")"); > + > + if (i < upperbound) > + fprintf_filtered (stream, " "); > } > if (*elts >= options->print_max && i < upperbound) > fprintf_filtered (stream, "..."); > diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp > index 4ca1db90f7f..8587c51e990 100644 > --- a/gdb/testsuite/gdb.fortran/array-slices.exp > +++ b/gdb/testsuite/gdb.fortran/array-slices.exp > @@ -38,14 +38,14 @@ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] > > set array_contents \ > [list \ > - " = \\(\\( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\( 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\( 31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\( 41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\( 51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\( 61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\( 71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\( 81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\( 91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\) \\)" \ > - " = \\(\\( 1, 2, 3, 4, 5\\) \\( 11, 12, 13, 14, 15\\) \\( 21, 22, 23, 24, 25\\) \\( 31, 32, 33, 34, 35\\) \\( 41, 42, 43, 44, 45\\) \\)" \ > - " = \\(\\( 1, 3, 5, 7, 9\\) \\( 21, 23, 25, 27, 29\\) \\( 41, 43, 45, 47, 49\\) \\( 61, 63, 65, 67, 69\\) \\( 81, 83, 85, 87, 89\\) \\)" \ > - " = \\(\\( 1, 4, 7, 10\\) \\( 21, 24, 27, 30\\) \\( 41, 44, 47, 50\\) \\( 61, 64, 67, 70\\) \\( 81, 84, 87, 90\\) \\)" \ > - " = \\(\\( 1, 5, 9\\) \\( 31, 35, 39\\) \\( 61, 65, 69\\) \\( 91, 95, 99\\) \\)" \ > - " = \\(\\( -26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\( -19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\( -12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\( -5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\( 16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\( 23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\( 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\( 37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\) \\)" \ > - " = \\(\\( -26, -25, -24, -23, -22, -21\\) \\( -19, -18, -17, -16, -15, -14\\) \\( -12, -11, -10, -9, -8, -7\\) \\)" \ > - " = \\(\\( -26, -24, -22, -20, -18\\) \\( -5, -3, -1, 1, 3\\) \\( 16, 18, 20, 22, 24\\) \\( 37, 39, 41, 43, 45\\) \\)" ] > + " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \ > + " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \ > + " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \ > + " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \ > + " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \ > + " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \ > + " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \ > + " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ] > > set message_strings \ > [list \ > diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp > index 9475ba3b393..cdee73ff5cb 100644 > --- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp > +++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp > @@ -40,4 +40,4 @@ gdb_continue_to_breakpoint "Break Here" > # cetainly going to fail. > gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)" > gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+" > -gdb_test "print this%_data%b" " = \\(\\( 1, 2, 3\\) \\( 4, 5, 6\\) \\)" > +gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)" > diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp > index ef6c6da8bd5..8cb419a0a7e 100644 > --- a/gdb/testsuite/gdb.fortran/multi-dim.exp > +++ b/gdb/testsuite/gdb.fortran/multi-dim.exp > @@ -57,7 +57,7 @@ gdb_test "print foo(3,3,4)" \ > "print an invalid array index (3,3,4)" > > gdb_test "print foo" \ > - { = \(\( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 20\) \) \)} \ > + { = \(\(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 20\)\)\)} \ > "print full contents of the array" > > gdb_breakpoint [gdb_get_line_number "break-variable"] > diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp > index e2b8d71b4cb..dbf85bb13d9 100755 > --- a/gdb/testsuite/gdb.fortran/vla-type.exp > +++ b/gdb/testsuite/gdb.fortran/vla-type.exp > @@ -66,9 +66,9 @@ gdb_test "ptype twov" \ > "\\s+$int, allocatable :: ivla1\\\(5,12,99\\\)" \ > "\\s+$int, allocatable :: ivla2\\\(9,12\\\)" \ > "End Type two" ] > -gdb_test "print twov" " = \\\( ivla1 = \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\ > - \\\( 1, 1, 321, 1, 1\\\)\ > - \\\( 1, 1, 1, 1, 1\\\) .*" > +gdb_test "print twov" " = \\\( ivla1 = \\\(\\\(\\\(1, 1, 1, 1, 1\\\)\ > + \\\(1, 1, 321, 1, 1\\\)\ > + \\\(1, 1, 1, 1, 1\\\) .*" > > # Check type with attribute at beginn of type > gdb_breakpoint [gdb_get_line_number "threev-filled"] > diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp > index 05e71e57ddd..e862725f48d 100644 > --- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp > +++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp > @@ -180,7 +180,7 @@ mi_run_cmd > mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ > { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" > mi_gdb_test "590-data-evaluate-expression pvla2" \ > - "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \ > + "590\\^done,value=\"\\(\\(2, 2, 2, 2, 2\\) \\(2, 2, 2, 2, 2\\)\\)\"" \ > "evaluate associated vla" > > mi_create_varobj_checked pvla2_associated pvla2 \ > -- > 2.25.4 >