[v2,33/37] GDB: testsuite: threads: Don't return 0 from top-level (sed)

Message ID 20260429230432.60487-34-thiago.bauermann@linaro.org
State New
Headers
Series GDB: testsuite: Fix top-level returns |

Commit Message

Thiago Jung Bauermann April 29, 2026, 11:04 p.m. UTC
  This patch is a bit different than the others.  I noticed that
gdb.threads has many cases of "return 0" from the top level, so this
patch is purely the result of running:

$ sed -i 's/^    return 0/    return/' *.exp*

inside gdb/testsuite/gdb.threads.

There were a number of false positives so not all sed changes were
incorporated.
---
 .../gdb.threads/attach-many-short-lived-threads.exp         | 2 +-
 gdb/testsuite/gdb.threads/corethreads.exp                   | 2 +-
 gdb/testsuite/gdb.threads/del-pending-thread-bp.exp         | 2 +-
 gdb/testsuite/gdb.threads/dlopen-libpthread.exp             | 2 +-
 gdb/testsuite/gdb.threads/hand-call-in-threads.exp          | 2 +-
 gdb/testsuite/gdb.threads/interrupted-hand-call.exp         | 2 +-
 .../gdb.threads/next-while-other-thread-longjmps.exp        | 2 +-
 gdb/testsuite/gdb.threads/pending-step.exp                  | 2 +-
 .../process-exit-status-is-leader-exit-status.exp           | 2 +-
 gdb/testsuite/gdb.threads/queue-signal.exp                  | 2 +-
 gdb/testsuite/gdb.threads/reconnect-signal.exp              | 6 +++---
 gdb/testsuite/gdb.threads/stop-with-handle.exp              | 2 +-
 gdb/testsuite/gdb.threads/thread-unwindonsignal.exp         | 2 +-
 gdb/testsuite/gdb.threads/threadapply.exp                   | 2 +-
 gdb/testsuite/gdb.threads/tls-nodebug-pie.exp               | 2 +-
 gdb/testsuite/gdb.threads/tls-shared.exp                    | 2 +-
 gdb/testsuite/gdb.threads/tls-so_extern.exp                 | 2 +-
 gdb/testsuite/gdb.threads/tls-var.exp                       | 2 +-
 gdb/testsuite/gdb.threads/watchthreads-reorder.exp          | 2 +-
 gdb/testsuite/gdb.threads/watchthreads.exp                  | 2 +-
 gdb/testsuite/gdb.threads/watchthreads2.exp                 | 2 +-
 gdb/testsuite/gdb.threads/wp-replication.exp                | 2 +-
 22 files changed, 24 insertions(+), 24 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index 0f1b141b1ea1..6f51e607d77d 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -44,11 +44,11 @@  proc bad_dejagnu {} {
     return 0
 }
 
 if {[bad_dejagnu]} {
     unsupported "broken DejaGnu"
-    return 0
+    return
 }
 
 require can_spawn_for_attach
 
 standard_testfile
diff --git a/gdb/testsuite/gdb.threads/corethreads.exp b/gdb/testsuite/gdb.threads/corethreads.exp
index 3749e3507bdc..4e520c5e8f22 100644
--- a/gdb/testsuite/gdb.threads/corethreads.exp
+++ b/gdb/testsuite/gdb.threads/corethreads.exp
@@ -28,11 +28,11 @@  if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executa
 }
 
 set corefile [core_find $binfile]
 if {$corefile == ""} {
     untested "unable to create or find corefile"
-    return 0
+    return
 }
 
 clean_restart $executable
 
 gdb_test "core-file $corefile" "Core was generated by .*" "load core"
diff --git a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
index 09a6f56a5660..c318b38b472a 100644
--- a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
+++ b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
@@ -43,11 +43,11 @@  if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
 }
 
 gdb_locate_shlib $binfile_lib
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Run until we have two threads.
 gdb_breakpoint "breakpt"
 gdb_continue_to_breakpoint "first breakpt call"
diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
index 03ce0dd1612d..01f2186bcdc8 100644
--- a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
@@ -13,11 +13,11 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 require isnative allow_shlib_tests
 if {![istarget *-linux*]} {
-    return 0
+    return
 }
 
 load_lib prelink-support.exp
 
 set testfile "dlopen-libpthread"
diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
index f6d29720cc6f..2f5eaa5405bf 100644
--- a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
+++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
@@ -45,11 +45,11 @@  proc get_dummy_frame_number { } {
 }
 
 clean_restart ${::testfile}
 
 if { ![runto_main] } {
-    return 0
+    return
 }
 
 gdb_test "break all_threads_running" \
 	 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
 	 "breakpoint on all_threads_running"
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index 23a3d038c09a..fe39b4ee9035 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -29,11 +29,11 @@  if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 }
 
 clean_restart ${::testfile}
 
 if { ![runto_main] } {
-    return 0
+    return
 }
 
 gdb_test "break all_threads_running" \
 	 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
 	 "breakpoint on all_threads_running"
diff --git a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
index 6852e8d7f876..0647ff5cb760 100644
--- a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
+++ b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
@@ -26,11 +26,11 @@  if {[prepare_for_testing "failed to prepare" \
 	 $testfile $srcfile {c++ debug pthreads}] == -1} {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint $linenum
 gdb_continue_to_breakpoint "start line"
 
diff --git a/gdb/testsuite/gdb.threads/pending-step.exp b/gdb/testsuite/gdb.threads/pending-step.exp
index c9ff1de32c89..a4fc5807167c 100644
--- a/gdb/testsuite/gdb.threads/pending-step.exp
+++ b/gdb/testsuite/gdb.threads/pending-step.exp
@@ -55,11 +55,11 @@  if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 }
 
 clean_restart ${::testfile}
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "insert breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint hit"
 
diff --git a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
index 8ecacba59d5e..80afd0e1f1a2 100644
--- a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
+++ b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
@@ -24,11 +24,11 @@ 
 # expected to be able to reproduce the error reliably.  Multiple
 # executions (or increasing the number of iterations) might be
 # required to reproduce the error with a misbehaving GDB.
 
 if { ![istarget "*-*-linux*"] } {
-    return 0
+    return
 }
 
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
diff --git a/gdb/testsuite/gdb.threads/queue-signal.exp b/gdb/testsuite/gdb.threads/queue-signal.exp
index 905f47c1243b..aaa5bc91818a 100644
--- a/gdb/testsuite/gdb.threads/queue-signal.exp
+++ b/gdb/testsuite/gdb.threads/queue-signal.exp
@@ -49,11 +49,11 @@  gdb_test_multiple "bt" "determine thread functions" {
 }
 
 # No point in continuing if we couldn't figure out which thread is which.
 if { $sigusr1_thread == 0 } {
     # FAIL already recorded.
-    return 0
+    return
 }
 
 # Advance each thread to where we want them one at a time.
 gdb_test_no_output "set scheduler-locking on"
 gdb_test_no_output "set var ready = 1"
diff --git a/gdb/testsuite/gdb.threads/reconnect-signal.exp b/gdb/testsuite/gdb.threads/reconnect-signal.exp
index e1079f3d1feb..f7a66ac844db 100644
--- a/gdb/testsuite/gdb.threads/reconnect-signal.exp
+++ b/gdb/testsuite/gdb.threads/reconnect-signal.exp
@@ -16,11 +16,11 @@ 
 # Test that disconnecting and reconnecting doesn't lose signals.
 
 set gdbserver_reconnect_p 1
 if { [info proc gdb_reconnect] == "" } {
     unsupported "requires gdbserver reconnect"
-    return 0
+    return
 }
 
 standard_testfile
 set executable ${testfile}
 
@@ -33,11 +33,11 @@  if { [gdb_compile_pthreads \
 }
 
 clean_restart $executable
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "continue" "signal SIGUSR1.*" "continue to signal"
 
 # Check that it's thread 2 that is selected.
@@ -65,11 +65,11 @@  set test "reconnect after signal"
 set res [gdb_reconnect]
 if { [lindex $res 0] == 0 } {
     pass $test
 } else {
     fail $test
-    return 0
+    return
 }
 
 # Check that thread 2 is re-selected.
 gdb_test "info threads" "\\* 2 .*" "thread 2 is selected on reconnect"
 
diff --git a/gdb/testsuite/gdb.threads/stop-with-handle.exp b/gdb/testsuite/gdb.threads/stop-with-handle.exp
index de40a3f1e946..be1d38602778 100644
--- a/gdb/testsuite/gdb.threads/stop-with-handle.exp
+++ b/gdb/testsuite/gdb.threads/stop-with-handle.exp
@@ -27,11 +27,11 @@  if {[prepare_for_testing "failed to prepare" \
 	 "${testfile}" "${srcfile}" {debug pthreads}]} {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Have SIGSTOP sent to the inferior.
 gdb_test "handle SIGSTOP nostop noprint pass" \
     [multi_line \
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index d77b323338cc..299d66b0516d 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -29,11 +29,11 @@  if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 }
 
 clean_restart ${::testfile}
 
 if { ![runto_main] } {
-    return 0
+    return
 }
 
 gdb_test "break all_threads_running" \
 	 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
 	 "breakpoint on all_threads_running"
diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp
index f8827ae7ea65..7fdc647705a9 100644
--- a/gdb/testsuite/gdb.threads/threadapply.exp
+++ b/gdb/testsuite/gdb.threads/threadapply.exp
@@ -30,11 +30,11 @@  clean_restart ${::testfile}
 #
 # Run to `main' where we begin our tests.
 #
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Break after all threads have been started.
 set break_line [gdb_get_line_number "Break here"]
 gdb_test "b $break_line" ".*"
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
index 9d2a805c4a5f..5e9c4ddd2e8b 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
@@ -20,10 +20,10 @@  if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
     return
 }
 
 clean_restart ${::testfile}
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Formerly: Cannot access memory at address 0xffffef7c0698
 gdb_test "p (int) thread_local_var" " = 42" "thread local storage"
diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp
index a293809105d6..2710145c9958 100644
--- a/gdb/testsuite/gdb.threads/tls-shared.exp
+++ b/gdb/testsuite/gdb.threads/tls-shared.exp
@@ -31,11 +31,11 @@  if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
 
 clean_restart ${::testfile}
 gdb_load_shlib ${binfile_lib}
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "print i_tls" "2" "print thread local storage variable"
 
 gdb_test "ptype i_tls" "int" "ptype of thread local storage variable"
diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.exp b/gdb/testsuite/gdb.threads/tls-so_extern.exp
index eb3f32df6210..f1c0b66ad935 100644
--- a/gdb/testsuite/gdb.threads/tls-so_extern.exp
+++ b/gdb/testsuite/gdb.threads/tls-so_extern.exp
@@ -30,11 +30,11 @@  if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
 
 clean_restart ${::testfile}
 gdb_load_shlib ${binfile_lib}
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "print so_extern" "0x0" "print thread local storage variable"
 
 gdb_test "ptype so_extern" "void \\*" "ptype of thread local storage variable"
diff --git a/gdb/testsuite/gdb.threads/tls-var.exp b/gdb/testsuite/gdb.threads/tls-var.exp
index 5b2968a7bd01..28d0886c6bfd 100644
--- a/gdb/testsuite/gdb.threads/tls-var.exp
+++ b/gdb/testsuite/gdb.threads/tls-var.exp
@@ -26,11 +26,11 @@  if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != "
 }
 
 clean_restart ${executable}
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # FAIL was: type = <thread local variable, no debug info>
 gdb_test "whatis tls_var" {type = const char \*}
 
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index 58b16be70f26..f56661d7a5c2 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -25,11 +25,11 @@ 
 # could be assigned during continuation of a thread with pending SIGTRAP to the
 # different/new watchpoint, just based on the watchpoint/debug register number.
 
 require allow_hw_watchpoint_access_tests allow_hw_watchpoint_multi_tests
 if {![istarget *-*-linux*]} {
-    return 0
+    return
 }
 
 standard_testfile
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
     return
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index e975e22e5730..2682db7b0328 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -37,11 +37,11 @@  gdb_test_no_output "set can-use-hw-watchpoints 1" ""
 #
 # Run to `main' where we begin our tests.
 #
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set args_0 0
 set args_1 0
 
diff --git a/gdb/testsuite/gdb.threads/watchthreads2.exp b/gdb/testsuite/gdb.threads/watchthreads2.exp
index 49884f4136dd..0efef51b7fc6 100644
--- a/gdb/testsuite/gdb.threads/watchthreads2.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads2.exp
@@ -38,11 +38,11 @@  gdb_test_no_output "set can-use-hw-watchpoints 1" ""
 #
 # Run to `main' where we begin our tests.
 #
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "break thread_started" \
 	 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
 	 "breakpoint on thread_started"
diff --git a/gdb/testsuite/gdb.threads/wp-replication.exp b/gdb/testsuite/gdb.threads/wp-replication.exp
index 28a5071bd5e5..cc9bc50f9b2e 100644
--- a/gdb/testsuite/gdb.threads/wp-replication.exp
+++ b/gdb/testsuite/gdb.threads/wp-replication.exp
@@ -39,11 +39,11 @@  clean_restart ${::testfile}
 # Force hardware watchpoints to be used.
 gdb_test_no_output "set can-use-hw-watchpoints 1" ""
 
 # Run to `main' where we begin our tests.
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Set some default values.
 set hwatch_count 0
 set count 0