From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id DCB393858C50 for ; Mon, 2 Jan 2023 16:27:24 +0000 (GMT) Received: from ubuntu.lan (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 19A2B803A5; Mon, 2 Jan 2023 16:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1672676843; bh=tUOhThWvQtWGFUNgxjWGATitBXp1uhAECrwMnXf7tsA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LWEO1vVeKwhl9dfGv03Z7Ss7JoKvz49Sl8BT6hQu4H+8FWcL0oMpnycvZgDZgJpVw tvpG9RKgKuffT823oxI4+VlRTBNEHThFzak90kqdvXulnu1DyDWjXrGtjTza0HjU/z EP07dOlGkkdoHFJKfGZ2TwZRTAHFq+kgzOPlv08bcmihnakZT9tfva/RdZVFcyFgMJ sxIs7i0VPI065iNzsQ6dDtozrDfDHoy2LUqOB4Z8d43XDXwO919AIavujS4c1H1ApB Sfiyj53wL+LiE5+M8MhFMRbpf0LqZ/hCuQ/Zwz+ZZPIdj6UKbv0glXNbxj7yrYcK2K QqPQHqtkQX7nw== Date: Mon, 2 Jan 2023 16:26:45 +0000 From: Lancelot SIX To: Bruno Larsen Cc: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: [PATCH v3] gdb: add 'maintenance print record-instruction' command Message-ID: <20230102162645.oudy2wxxtmlm355r@ubuntu.lan> References: <20221222154338.2223678-1-blarsen@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221222154338.2223678-1-blarsen@redhat.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Mon, 02 Jan 2023 16:27:23 +0000 (UTC) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Bruno > diff --git a/gdb/testsuite/gdb.reverse/maint-print-instruction.c b/gdb/testsuite/gdb.reverse/maint-print-instruction.c > new file mode 100644 > index 00000000000..f06ed530620 > --- /dev/null > +++ b/gdb/testsuite/gdb.reverse/maint-print-instruction.c > @@ -0,0 +1,25 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2022 Free Software Foundation, Inc. Just mentioning so you do not forget, this will need to change to 2022-2023 before this gets pushed. > + > + 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 . */ > + > +int > +main () > +{ > + int x = 0; > + x ++; > + x --; > + return x; > +} > diff --git a/gdb/testsuite/gdb.reverse/maint-print-instruction.exp b/gdb/testsuite/gdb.reverse/maint-print-instruction.exp > new file mode 100644 > index 00000000000..b78b696add6 > --- /dev/null > +++ b/gdb/testsuite/gdb.reverse/maint-print-instruction.exp > @@ -0,0 +1,66 @@ > +# Copyright 2008-2022 Free Software Foundation, Inc. Should be 2022-2023. > + > +# 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 . > + > +# This file is part of the GDB testsuite. it tests the functionality of ^ Missing an uppercase here. > +# the maintenance print record-instruction command, but does not check the > +# syntax, only if the command finds or fails to find recorded history. > + > +if ![supports_reverse] { > + return > +} > + > +standard_testfile > + > +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { > + return -1 > +} > + > +proc test_print { has_history level test_name } { > + gdb_test_multiple "maint print record-instruction $level" $test_name { > + -re -wrap ".*Not enough recorded history.*" { > + gdb_assert !$has_history $test_name > + } > + > + -re -wrap ".*changed.*" { > + gdb_assert $has_history $test_name > + } > + } > +} > + > +if { ![runto_main] } { > + return 0 > +} > + > +test_print false "" "print before starting to record" > + > +if [supports_process_record] { > + # Activate process record/replay > + gdb_test_no_output "record" "turn on process record" > +} > + I do not think the rest of the test makes much sense if [supports_process_record] returns false, does it? I guess that everything below this point should be be in the if block. Another approach might to have the initial test (at the top of the file) check for both supports_reverse and supports_process_record and ignore the test if either feature is not supported. WDYT? For what it is worth, the rest of the patch looks OK to me. Best, Lancelot. > +test_print false "" "print before any instruction" > + > +gdb_test "stepi 3" ".*" "collecting history" > +test_print true "" "print current after executing a bit" > +test_print true "-1" "print previous after executing a bit" > +test_print false "1" "print following after executing a bit" > + > +gdb_test "reverse-stepi" ".*" "moving back" > +test_print true "" "print current after reversing" > +test_print true "-1" "print previous after reversing" > +test_print true "1" "print following after reversing" > + > +test_print false "-10" "trying to print too far back" > +test_print false "10" "trying to print too far forward" > -- > 2.38.1 >