public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Allow 'interrupt -a' in all-stop mode
Date: Wed,  8 Jun 2022 09:27:54 -0600	[thread overview]
Message-ID: <20220608152754.1369001-1-tromey@adacore.com> (raw)

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
---
 gdb/infcmd.c                                |  3 --
 gdb/testsuite/gdb.base/interrupt-daemon.exp | 36 +++++++++++----------
 2 files changed, 19 insertions(+), 20 deletions(-)

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-daemon.exp b/gdb/testsuite/gdb.base/interrupt-daemon.exp
index 0c71a6df71c..8dcbf778222 100644
--- a/gdb/testsuite/gdb.base/interrupt-daemon.exp
+++ b/gdb/testsuite/gdb.base/interrupt-daemon.exp
@@ -58,28 +58,30 @@ proc do_test {} {
 	}
     }
 
-    with_test_prefix "bg" {
-
-	set test "continue&"
-	gdb_test_multiple "continue&" $test {
-	    -re "Continuing\\.\r\n$gdb_prompt " {
-		pass $test
+    foreach arg {"" "-a"} {
+	with_test_prefix "bg$arg" {
+
+	    set test "continue&"
+	    gdb_test_multiple "continue&" $test {
+		-re "Continuing\\.\r\n$gdb_prompt " {
+		    pass $test
+		}
 	    }
-	}
 
-	after 200
+	    after 200
 
-	set test "interrupt"
-	gdb_test_multiple $test $test {
-	    -re "$gdb_prompt " {
-		pass $test
+	    set test "interrupt $arg"
+	    gdb_test_multiple $test $test {
+		-re "$gdb_prompt " {
+		    pass $test
+		}
 	    }
-	}
 
-	set test "interrupt cmd stops process"
-	gdb_test_multiple "" $test {
-	    -re "received signal SIGINT" {
-		pass $test
+	    set test "interrupt cmd stops process"
+	    gdb_test_multiple "" $test {
+		-re "received signal SIGINT" {
+		    pass $test
+		}
 	    }
 	}
     }
-- 
2.34.1


             reply	other threads:[~2022-06-08 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 15:27 Tom Tromey [this message]
2022-06-09 15:40 ` Pedro Alves
2022-06-10 15:52   ` Tom Tromey
2022-06-13 14:10     ` Pedro Alves
2022-06-14 15:04       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220608152754.1369001-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).