aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2025-05-12 09:10:55 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2025-05-12 09:11:19 +0200
commit0ea1e5df96b15f3652ca6a9182c428101271caa5 (patch)
tree861d52b1b6b572356247f88086c114a34734a6a6
parent32c39bab07b6cfcf42c899e65c39b7a9a9d2d9fe (diff)
downloadbinutils-0ea1e5df96b15f3652ca6a9182c428101271caa5.zip
binutils-0ea1e5df96b15f3652ca6a9182c428101271caa5.tar.gz
binutils-0ea1e5df96b15f3652ca6a9182c428101271caa5.tar.bz2
gdb: update "info threads" output when no threads match the arguments
If "info threads" is provided with the thread ID argument but no such threads matching the thread ID(s) are found, GDB prints No threads match '<ID...>'. Update this output to the more generalized No threads matched. The intention is that the next patch, and potentially future ones, will extend the command with more filter/match arguments. We cannot customize the output to each such argument. Hence, be more generic. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-by: Pedro Alves <pedro@palves.net
-rw-r--r--gdb/NEWS7
-rw-r--r--gdb/testsuite/gdb.multi/tids.exp4
-rw-r--r--gdb/testsuite/gdb.threads/current-lwp-dead.exp2
-rw-r--r--gdb/testsuite/gdb.threads/thread-bp-deleted.exp2
-rw-r--r--gdb/thread.c3
5 files changed, 12 insertions, 6 deletions
diff --git a/gdb/NEWS b/gdb/NEWS
index a82b7e3..18a8b74 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -90,6 +90,13 @@ info sharedlibrary
command are now for the full memory range allocated to the shared
library.
+info threads [-gid] [ID]...
+ If no threads match the given ID(s), GDB now prints
+
+ No threads matched.
+
+ without printing the provided argument.
+
* GDB-internal Thread Local Storage (TLS) support
** Linux targets for the x86_64, aarch64, ppc64, s390x, and riscv
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index b84f908..dab6275 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -290,7 +290,7 @@ with_test_prefix "two inferiors" {
# Try both the convenience variable and the literal number.
foreach thr {"\$thr" "20" "1.20" "\$inf.1" "30.1" } {
set expected [string_to_regexp $thr]
- gdb_test "info threads $thr" "No threads match '${expected}'."
+ gdb_test "info threads $thr" "No threads matched\\."
# "info threads" works like a filter. If there's any other
# valid thread in the list, there's no error.
info_threads "$thr 1.1" "1.1"
@@ -412,7 +412,7 @@ with_test_prefix "two inferiors" {
# Check that we do parse the inferior number and don't confuse it.
gdb_test "info threads 3.1" \
- "No threads match '3.1'\."
+ "No threads matched\\."
}
if { [allow_python_tests] } {
diff --git a/gdb/testsuite/gdb.threads/current-lwp-dead.exp b/gdb/testsuite/gdb.threads/current-lwp-dead.exp
index 7aa7ab9..c8364df 100644
--- a/gdb/testsuite/gdb.threads/current-lwp-dead.exp
+++ b/gdb/testsuite/gdb.threads/current-lwp-dead.exp
@@ -47,6 +47,6 @@ gdb_breakpoint $line
gdb_continue_to_breakpoint "fn_return" ".*at-fn_return.*"
# Confirm thread 2 is really gone.
-gdb_test "info threads 2" "No threads match '2'\\."
+gdb_test "info threads 2" "No threads matched\\."
gdb_continue_to_end "" continue 1
diff --git a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
index 2eadd38..8cabb70 100644
--- a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
+++ b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
@@ -147,7 +147,7 @@ if {$is_remote} {
exp_continue
}
- -re "No threads match '99'\\.\r\n$gdb_prompt $" {
+ -re "No threads matched\\.\r\n$gdb_prompt $" {
if {!$saw_thread_exited && !$saw_bp_deleted && $attempt_count > 0} {
sleep 1
incr attempt_count -1
diff --git a/gdb/thread.c b/gdb/thread.c
index 3375cfc..d84d326 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1285,8 +1285,7 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
if (requested_threads == NULL || *requested_threads == '\0')
uiout->message (_("No threads.\n"));
else
- uiout->message (_("No threads match '%s'.\n"),
- requested_threads);
+ uiout->message (_("No threads matched.\n"));
return;
}