]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, testsuite: unify 'Switching to thread' message
authorRohr, Stephan <stephan.rohr@intel.com>
Tue, 16 Jun 2026 10:52:30 +0000 (10:52 +0000)
committerRohr, Stephan <stephan.rohr@intel.com>
Thu, 18 Jun 2026 09:07:03 +0000 (09:07 +0000)
The 'normal_stop ()' function in infrun prints

  [Switching to Thread 0x155554dff6c0 (LWP 77976)]

on thread switch.  The 'print_selected_thread_frame ()' function
in thread.c prints

  [Switching to thread 2 (Thread 0x155554dff6c0 (LWP 96643))]

Ensure consistent output by updating the thread switch message in
'normal_stop'.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/infrun.c
gdb/testsuite/gdb.replay/missing-thread.exp
gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp
gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp
gdb/testsuite/gdb.threads/manythreads.exp
gdb/testsuite/gdb.threads/stepi-over-clone.exp

index 00bedc7b6aecf84c1d9c129ee3db93df28cb30b9..f51d301cf39a0a0e592e8f10ab2fe286c1460382 100644 (file)
@@ -9762,7 +9762,8 @@ normal_stop ()
          SWITCH_THRU_ALL_UIS ()
            {
              target_terminal::ours_for_output ();
-             gdb_printf (_("[Switching to %s]\n"),
+             gdb_printf (_("[Switching to thread %s (%s)]\n"),
+                         print_thread_id (inferior_thread ()),
                          target_pid_to_str (inferior_ptid).c_str ());
              annotate_thread_changed ();
            }
index 6a4eaaaafcce4d97805a0f5d9c6122eb2dca6677..e3844c82453691d88ee2a39d10ac5e5aab4c9d62 100644 (file)
@@ -162,7 +162,7 @@ proc_with_prefix replay_with_log { remote_log expect_error non_stop } {
                 "warning: command aborted, Thread \[^\r\n\]+ unexpectedly exited after signal stop event"]
 
        if { !$non_stop } {
-           lappend expected_output "\\\[Switching to Thread \[^\r\n\]+\\\]"
+           lappend expected_output "\\\[Switching to thread \[^\r\n\]+\\\]"
        }
 
        gdb_test "continue" [multi_line {*}$expected_output]
index 530f231d49c13acc2a87d68400aba4b1b7938b45..fa13a61e74685c0696847e1c12f5a19884852ea2 100644 (file)
@@ -132,7 +132,7 @@ proc run_condition_test { stop_at_cond other_thread_signal \
                 "Continuing\\." \
                 ".*" \
                 "Thread ${::decimal} \"\[^\"\r\n\]+\" received signal SIGSEGV, Segmentation fault\\." \
-                "\\\[Switching to Thread \[^\r\n\]+\\\]" \
+                "\\\[Switching to thread \[^\r\n\]+\\\]" \
                 "${::hex} in worker_func \[^\r\n\]+:${::signal_line}" \
                 "${::decimal}\\s+\[^\r\n\]+Signal here\[^\r\n\]+"] \
            "received signal in other thread"
index 56c2d60f163fda58c723d70f38dee4d0977e1c93..041bf2076c43272037719f3c8e1c71d9ebf5389f 100644 (file)
@@ -155,7 +155,7 @@ proc run_test { target_async target_non_stop non_stop other_thread_bp unwind } {
                 "Continuing\\." \
                 ".*" \
                 "Thread ${::decimal} \"infcall-from-bp\" received signal SIGSEGV, Segmentation fault\\." \
-                "\\\[Switching to Thread \[^\r\n\]+\\\]" \
+                "\\\[Switching to thread \[^\r\n\]+\\\]" \
                 "${::hex} in do_segfault \\(\\) at \[^\r\n\]+:${::segfault_line}" \
                 "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+"] \
            "hit the segfault"
index aabbb24b4d9ef056a7dd800ea69d653874ff7261..ba665df24ae969cd41ab3afbe5b43f0abf2553f8 100644 (file)
@@ -84,7 +84,7 @@ proc interrupt_and_wait { message } {
            #  [New Thread NNN]
            #  [New Thread NNN]
            #  ... pages of new threads output ...
-           #  [Switching to Thread NNN]
+           #  [Switching to thread NNN]
            #  foo () at foo.c:31
            #  31      bar ();
            #
index 7a887d7d18420cc91f373cd276ab4b963529c329..cc50c30e06a40c0ae313e472b8ae8b58d16672c3 100644 (file)
@@ -173,7 +173,7 @@ proc test {non_stop displaced third_thread} {
                    incr stepi_new_thread_count
                    exp_continue
                }
-               -re "^\\\[Switching to Thread\[^\r\n\]+\\\]\r\n" {
+               -re "^\\\[Switching to thread\[^\r\n\]+\\\]\r\n" {
                    verbose -log "XXX: Consume switching to thread line"
                    exp_continue
                }