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.129.124]) by sourceware.org (Postfix) with ESMTPS id 1DDA73858D32 for ; Mon, 2 Jan 2023 16:56:16 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672678575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=snAtjwAgswspYaK3yCCHQuULhmAZ+4wHuk5WJFF4N0o=; b=OcfsarJXiZHN4pQ7iu9CCykszfItwC+EavOW4ifzTW0Lphn6umRZJZjWyDpVpbXjYig6zx 3rGMKz9HOFJ2CmkaQU0U4KJlybhPZHfW1lNcajcWOsGzMy9Hn+WTkuNjAnlqxfhwpflHoE oPIxjAUYzxwSxmVm4lYjoXqALAYtZwk= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-7-eBw0lyrqOi2hEM32XjtrpQ-1; Mon, 02 Jan 2023 11:56:14 -0500 X-MC-Unique: eBw0lyrqOi2hEM32XjtrpQ-1 Received: by mail-ej1-f71.google.com with SMTP id wz4-20020a170906fe4400b0084c7e7eb6d0so7923507ejb.19 for ; Mon, 02 Jan 2023 08:56:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=snAtjwAgswspYaK3yCCHQuULhmAZ+4wHuk5WJFF4N0o=; b=M9CG3w1mLS+ZY1zDfggwshPjl0gs6c5dyYnY6lb36p3t7ITCUtDs6Y06faMj/+vbPs 45WErokZC3nGBh0Opt8S53rWAPs7G/HoOT5yrbv2YW+cRhOIofroruO/boKMvQ/XAg5f osDhhYO3BHSHCEsqNDDQMsbSbwN0VtXODICy1LLeOalAYoBkrK3OFXzVz4h6ucGBfgGn 8qQgc98zZF17Ax1QmqjUZqU6vEUcsaVuvFvrBhMXrCx8l4IbU8jqteHfGY07QaAUnx/7 XB1Fa6dndevjuFX85sxyij2RRTo2gPrCyQNzZXs7WHkZ/MbIo2D5Cc0MY8mBRuvOpVkn QcuA== X-Gm-Message-State: AFqh2kr8r62h2fytRuaT9KxNSDPWy2PvKZPmMmyO5f3b56AfhHym7OY5 /wAI5CrU8bq3ssvvFsXhmn5bae09CIN8wgJO9LRAVBoq/US+hk5Xg38ZaVVI6OHtyqZ1CtkwSCU nrC8YYsS1G4J4MJfUz5wdUQ== X-Received: by 2002:a17:906:374e:b0:7c1:f64:61f1 with SMTP id e14-20020a170906374e00b007c10f6461f1mr42612075ejc.45.1672678573381; Mon, 02 Jan 2023 08:56:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXugsE0wzEfPxHl37N6nfQAQVOmeTR9sJaE0PtXd0XOAXOOe8p4HsEgmF58co8F6MfcuM2YaxQ== X-Received: by 2002:a17:906:374e:b0:7c1:f64:61f1 with SMTP id e14-20020a170906374e00b007c10f6461f1mr42612069ejc.45.1672678573125; Mon, 02 Jan 2023 08:56:13 -0800 (PST) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id g32-20020a056402322000b0048c85c5ad30sm2884426eda.83.2023.01.02.08.56.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Jan 2023 08:56:12 -0800 (PST) Message-ID: <1a74eebc-2ecd-7334-b702-52185c6820bf@redhat.com> Date: Mon, 2 Jan 2023 17:56:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v3] gdb: add 'maintenance print record-instruction' command To: Lancelot SIX Cc: gdb-patches@sourceware.org, Eli Zaretskii References: <20221222154338.2223678-1-blarsen@redhat.com> <20230102162645.oudy2wxxtmlm355r@ubuntu.lan> From: Bruno Larsen In-Reply-To: <20230102162645.oudy2wxxtmlm355r@ubuntu.lan> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: On 02/01/2023 17:26, Lancelot SIX wrote: > 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. nice catch, thanks! > >> + >> + 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? Good call, but since I do think it makes sense to test that GDB doesn't go wild even if recording is not supported, I think I'll make the test exit early here instead. > > For what it is worth, the rest of the patch looks OK to me. Awesome, may I add your R-b tag, or do you want to see my change to the test first? > > 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 >> -- Cheers, Bruno