From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id woITDcgMs2MdIw4AWB0awg (envelope-from ) for ; Mon, 02 Jan 2023 11:56:40 -0500 Received: by simark.ca (Postfix, from userid 112) id 2D9941E222; Mon, 2 Jan 2023 11:56:40 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=N/Li3uEh; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 2E6291E0D3 for ; Mon, 2 Jan 2023 11:56:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA7A03858C27 for ; Mon, 2 Jan 2023 16:56:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA7A03858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672678598; bh=snAtjwAgswspYaK3yCCHQuULhmAZ+4wHuk5WJFF4N0o=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=N/Li3uEhrH24j77yFrFGb55VcXW8ZDe3iym0FzvbuXG4fac8v3q08evw6XpLNYOow QrAyHLUpn4TBgXIIQkrS1KA9EISFh2U3XlKeIiTNt/Ln3Y+1Hk1E7d5IOUCyWMyZBN IjaYkMgBuyUaj+ie4y+uWjs8D5fDzfF1pvG8stmk= 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) 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> 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-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: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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