From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id B2DD5385AE75 for ; Mon, 13 Jun 2022 14:10:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2DD5385AE75 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id z9so3040665wmf.3 for ; Mon, 13 Jun 2022 07:10:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=sJ9X3jW0AuzQr8HgCWso9vF/yKv8WOs6vTjn+HdnogA=; b=V1AJqNMQAEjGEq6NfhIjRDMMKY2zauOJhoASjhNOf9k+/RiwXdRxd0O2f+vbDJ6Gfo b6veOGG7ivnlCg9qnB61TyClPVYHXBP5pXpfsxH9YjZD5plDsv9AwEFu4YJ8Dci3Sz4o G5t0Hcv5cG206I56E7zPDdahxsbMmcqW+HRauznpH+BbvzaxDIXOXLAbAhi5XHNP/MCG 2s7xQ9/+kWyFwOmbEuv6xA+N053MLavu+lxCB1Dd1ONOHkRjO/DDnajGHf9U+aKK7YrN Hv8SZAbsbY81MDf3iyz/QLKDLvFyWUKmB2LtI3ydFh+3YvfdEnfuXGdcR52bR0qKSjkf 6Ejg== X-Gm-Message-State: AOAM533zDsOEUEikhuNY3Q8VqOdFND5T5E7cLNlzuo0FnHIxHE1BXJ7s hk/Qg7kyCTFtvAjPwKPMtabSOpLnBbU= X-Google-Smtp-Source: ABdhPJxz5Nhn7h3c3rlfiBgoXgpmjvqIH2K+WfLrzvjqYEmpmSzsKU5DnnC5oOBNQfyAY8gIz5myHA== X-Received: by 2002:a05:600c:202:b0:39c:40de:ec19 with SMTP id 2-20020a05600c020200b0039c40deec19mr14834710wmi.29.1655129409476; Mon, 13 Jun 2022 07:10:09 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id l30-20020adfa39e000000b00215859413f3sm9015852wrb.107.2022.06.13.07.10.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jun 2022 07:10:08 -0700 (PDT) Message-ID: Date: Mon, 13 Jun 2022 15:10:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] Allow 'interrupt -a' in all-stop mode Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20220608152754.1369001-1-tromey@adacore.com> <8d25f1c9-d4fe-7eca-e3fc-1840482fb914@palves.net> <87y1y4y0qx.fsf@tromey.com> From: Pedro Alves In-Reply-To: <87y1y4y0qx.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 13 Jun 2022 14:10:17 -0000 On 2022-06-10 16:52, Tom Tromey wrote: > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#include > + > +int > +main () > +{ > + while (1) > + sleep (50); We try to avoid having testcases that run forever if GDB misbehaves. For more complicated threading tests, we end up with something like: /* Don't run forever. */ alarm (300); For simpler testcases, we can just do something like: int i; for (i = 0; i < 60; i++) sleep (1); ('i' should not be declared within the 'for' so that this compiles with compilers that default to C89/C90.) ... which avoids introducing the depending on "alarm", which does not exist on all targets. > +} > diff --git a/gdb/testsuite/gdb.base/interrupt-a.exp b/gdb/testsuite/gdb.base/interrupt-a.exp > new file mode 100644 > index 00000000000..9c65d6edd5f > --- /dev/null > +++ b/gdb/testsuite/gdb.base/interrupt-a.exp > @@ -0,0 +1,50 @@ > +# Copyright (C) 2022 Free Software Foundation, Inc. > + > +# 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 . > + > +# Test that 'interrupt -a' works in all stop mode. > + > +standard_testfile .c > +set executable ${testfile} > + > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { > + return -1 > +} > + > +if {![runto_main]} { > + return -1 > +} > + > +set test "continue &" > +gdb_test_multiple "continue&" $test { > + -re "Continuing\\.\r\n$gdb_prompt " { > + pass $test > + } > +} You can get rid of the test variable (throughout) by using $gdb_test_name, like: gdb_test_multiple "continue &" "" { -re "Continuing\\.\r\n$gdb_prompt " { pass $gdb_test_name } } > + > +set test "interrupt -a" > +gdb_test_multiple $test $test { > + -re "$gdb_prompt " { > + pass $test > + } > +} > + > +after 200 This sleep normally appears after the "continue &" command, to give a bit of time for the program to run after GDB prints "Continuing". Here, after an "interrupt" command it doesn't appear necessary. I think you want to move it to right after the continue command. > + > +set test "inferior stopped" > +gdb_test_multiple "" $test { > + -re "Program received signal" { > + pass $test > + } > +} > Otherwise LGTM. Thanks.