From: Rohr, Stephan Date: Tue, 16 Jun 2026 10:52:30 +0000 (+0000) Subject: gdb, testsuite: unify 'Switching to thread' message X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=478b1846cdb82b776c8dcbec20ecd198297cd8ff;p=thirdparty%2Fbinutils-gdb.git gdb, testsuite: unify 'Switching to thread' message 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 --- diff --git a/gdb/infrun.c b/gdb/infrun.c index 00bedc7b6ae..f51d301cf39 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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 (); } diff --git a/gdb/testsuite/gdb.replay/missing-thread.exp b/gdb/testsuite/gdb.replay/missing-thread.exp index 6a4eaaaafcc..e3844c82453 100644 --- a/gdb/testsuite/gdb.replay/missing-thread.exp +++ b/gdb/testsuite/gdb.replay/missing-thread.exp @@ -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] diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp index 530f231d49c..fa13a61e746 100644 --- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp +++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp index 56c2d60f163..041bf2076c4 100644 --- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp +++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp index aabbb24b4d9..ba665df24ae 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -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 (); # diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.exp b/gdb/testsuite/gdb.threads/stepi-over-clone.exp index 7a887d7d184..cc50c30e06a 100644 --- a/gdb/testsuite/gdb.threads/stepi-over-clone.exp +++ b/gdb/testsuite/gdb.threads/stepi-over-clone.exp @@ -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 }