From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id 9DC00385C30B for ; Fri, 10 Jun 2022 15:52:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9DC00385C30B Received: by mail-io1-xd33.google.com with SMTP id p69so6901683iod.0 for ; Fri, 10 Jun 2022 08:52:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=5nPdcefqMH8lRrePhRQdXtbE/syg+CXYnW2EJOteWu8=; b=S5XjI2qOiHOGloI6KNHNr2uHLr+H42sW0pv0uFGp+3LiBbWDVKEoJaAHakhD8e36FW 23WQ7lmVNo0lvZCnCnmcztRoTtyabJMg3pH27LGPXaHjGMk2L94cfLvEdj1nMJp5vwe4 fQ03HM2fN37skGh8ZNpvxjYONzELWSRg7cAP0KCKByAUmv9SbZ127QxTUIUxbvWFx1va Xt+Vg6QEB3ycgJa3DY+d6RpUCFZcsqOkhDz4b5NrMcC4GEnGFTP3l6cb+MF68KB8ZvXu j/OcVi1dUrOPpWLg+J4ydyTZnIWw17rs1X8DKzj5vHCOx0hw0Ku/UjyajSxDqhbg09QH jNaQ== X-Gm-Message-State: AOAM531+GNOsT0pzLi4KfeIO0uuxOFfnA8Rne5JumeeTRTgmuqBGlqds zbE8j/8FyevfbC1GdFxcitCUNWzMnciBuw== X-Google-Smtp-Source: ABdhPJy8avN9GM0kxVFtMy4kBH6GWLqnpbdmauIlTsmUNHpxkimvITUFF2P/DPCvp0AcKrJrw0nwZg== X-Received: by 2002:a02:6619:0:b0:32e:25b7:d9ed with SMTP id k25-20020a026619000000b0032e25b7d9edmr24325183jac.30.1654876343932; Fri, 10 Jun 2022 08:52:23 -0700 (PDT) Received: from murgatroyd (71-211-171-143.hlrn.qwest.net. [71.211.171.143]) by smtp.gmail.com with ESMTPSA id c8-20020a023f48000000b0032e1a07228asm10898855jaf.26.2022.06.10.08.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 08:52:23 -0700 (PDT) From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Allow 'interrupt -a' in all-stop mode References: <20220608152754.1369001-1-tromey@adacore.com> <8d25f1c9-d4fe-7eca-e3fc-1840482fb914@palves.net> X-Attribution: Tom Date: Fri, 10 Jun 2022 09:52:22 -0600 In-Reply-To: <8d25f1c9-d4fe-7eca-e3fc-1840482fb914@palves.net> (Pedro Alves's message of "Thu, 9 Jun 2022 16:40:22 +0100") Message-ID: <87y1y4y0qx.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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: Fri, 10 Jun 2022 15:52:26 -0000 Pedro> The testcase part, I'd rather this wasn't done in gdb.base/interrupt-daemon.exp, Pedro> as it's very unrelated to the purpose of that test. I'd rather a new testcase Pedro> called, say, continue_-a.exp. How about this? Tom commit 5794300eaff799c2019aaa481d2c8a51662ffe05 Author: Tom Tromey Date: Wed Jun 8 09:26:08 2022 -0600 Allow 'interrupt -a' in all-stop mode PR gdb/17160 points out that "interrupt -a" errors in all-stop mode, but there's no good reason for this. This patch removes the error. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17160 diff --git a/gdb/infcmd.c b/gdb/infcmd.c index e909d4d4c81..18590259339 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2874,9 +2874,6 @@ interrupt_command (const char *args, int from_tty) && startswith (args, "-a")) all_threads = 1; - if (!non_stop && all_threads) - error (_("-a is meaningless in all-stop mode.")); - interrupt_target_1 (all_threads); } } diff --git a/gdb/testsuite/gdb.base/interrupt-a.c b/gdb/testsuite/gdb.base/interrupt-a.c new file mode 100644 index 00000000000..3e67045e9da --- /dev/null +++ b/gdb/testsuite/gdb.base/interrupt-a.c @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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 . */ + +#include + +int +main () +{ + while (1) + sleep (50); +} 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 + } +} + +set test "interrupt -a" +gdb_test_multiple $test $test { + -re "$gdb_prompt " { + pass $test + } +} + +after 200 + +set test "inferior stopped" +gdb_test_multiple "" $test { + -re "Program received signal" { + pass $test + } +}