From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YCKUAHVYhF+PaAAAWB0awg (envelope-from ) for ; Mon, 12 Oct 2020 09:21:57 -0400 Received: by simark.ca (Postfix, from userid 112) id E8E531EF6F; Mon, 12 Oct 2020 09:21:56 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 383301E58C for ; Mon, 12 Oct 2020 09:21:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B70443857C45; Mon, 12 Oct 2020 13:21:55 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7CB3A386EC4D for ; Mon, 12 Oct 2020 13:21:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7CB3A386EC4D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BA2F01E58C; Mon, 12 Oct 2020 09:21:51 -0400 (EDT) Subject: Re: [PATCHv5 3/4] gdb/fortran: add support for parsing array strides in expressions To: Andrew Burgess , gdb-patches@sourceware.org References: <02f3e9f571844809528e74c2a8621b4ec467e22f.1602439661.git.andrew.burgess@embecosm.com> From: Simon Marchi Message-ID: Date: Mon, 12 Oct 2020 09:21:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <02f3e9f571844809528e74c2a8621b4ec467e22f.1602439661.git.andrew.burgess@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Just some nits: On 2020-10-11 2:12 p.m., Andrew Burgess wrote: > @@ -314,6 +318,40 @@ subrange: ':' %prec ABOVE_COMMA > write_exp_elt_opcode (pstate, OP_RANGE); } > ; > > +/* And each of the four subrange types can also have a stride. */ > +subrange: exp ':' exp ':' exp %prec ABOVE_COMMA > + { write_exp_elt_opcode (pstate, OP_RANGE); > + write_exp_elt_longcst (pstate, > + (RANGE_STANDARD > + | RANGE_HAS_STRIDE)); It's no necessary to have "RANGE_STANDARD" here. > @@ -141,6 +141,14 @@ value_f90_subarray (struct value *array, > else > high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); > > + if ((range_flag & RANGE_HAS_STRIDE) == RANGE_HAS_STRIDE) For consistency with the code just above this, this could be just: if (range_flag & RANGE_HAS_STRIDE) > diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp > index 31f95a3668d..a0e1d1fe8fc 100644 > --- a/gdb/testsuite/gdb.fortran/array-slices.exp > +++ b/gdb/testsuite/gdb.fortran/array-slices.exp > @@ -69,3 +69,18 @@ foreach result $array_contents msg $message_strings { > } > > gdb_continue_to_breakpoint "continue to Final Breakpoint" > + > +# Next test that asking for an array with stride at the CLI gives an > +# error. > +clean_restart ${testfile} > + > +if ![fortran_runto_main] then { > + perror "couldn't run to main" > + continue > +} > + > +gdb_breakpoint "show" > +gdb_continue_to_breakpoint "show" > +gdb_test "up" ".*" > +gdb_test "p array (1:10:2, 1:10:2)" \ > + "Fortran array strides are not currently supported" It would be better to give an name to this test, since the command ends with a parenthesis, or remove the space, as mentioned here: https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages Simon