]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: update "info threads" output when no threads match the arguments
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 12 May 2025 07:10:55 +0000 (09:10 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 12 May 2025 07:11:19 +0000 (09:11 +0200)
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
gdb/NEWS
gdb/testsuite/gdb.multi/tids.exp
gdb/testsuite/gdb.threads/current-lwp-dead.exp
gdb/testsuite/gdb.threads/thread-bp-deleted.exp
gdb/thread.c

index a82b7e3342c57b9b066e9012c5a961ad6ba839f0..18a8b7475b44b54c6ab3c857d84e84717e728639 100644 (file)
--- 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
index b84f9080cbd2807543d9e7285aadb6dcb3e6eb89..dab6275dc03cfb25c9ab88ef5157431a06226dec 100644 (file)
@@ -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] } {
index 7aa7ab951b58dd0b483265e9370d61e13280e527..c8364df0b845d960df1c3d7e398eaca7b9cf6f32 100644 (file)
@@ -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
index 2eadd380370df8a5df4bd43bf3c76c748be620a4..8cabb709c0c3a67d29286fdffc9cb8e0f59faf36 100644 (file)
@@ -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
index 3375cfcee244449cf1f907d0e17b05d819cc7556..d84d326a8c3b9dd916af9b65ae3aa4954b52a66f 100644 (file)
@@ -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;
          }