]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
GDB: testsuite: threads: Don't return value from top-level (manual)
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Wed, 29 Apr 2026 23:04:25 +0000 (20:04 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Fri, 8 May 2026 21:55:59 +0000 (18:55 -0300)
This patch manually changes "return -1" statements that weren't caught
by the sed command.

These return statements fall into one of these criteria:

- misaligned line, which is then fixed by this patch;
- return at top level but inside block such as for loops,
  with_test_prefix, foreach_with_prefix, gdb_test_multiple.

I also fixed a couple cases of "return 0" from top-level that also
weren't caught by sed, and even a couple cases of "return 1" from
top-level.

Approved-By: Tom Tromey <tom@tromey.com>
16 files changed:
gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
gdb/testsuite/gdb.threads/corethreads.exp
gdb/testsuite/gdb.threads/create-fail.exp
gdb/testsuite/gdb.threads/gcore-stale-thread.exp
gdb/testsuite/gdb.threads/gcore-thread.exp
gdb/testsuite/gdb.threads/linux-dp.exp
gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
gdb/testsuite/gdb.threads/omp-par-scope.exp
gdb/testsuite/gdb.threads/omp-task.exp
gdb/testsuite/gdb.threads/siginfo-threads.exp
gdb/testsuite/gdb.threads/staticthreads.exp
gdb/testsuite/gdb.threads/stepi-over-clone.exp
gdb/testsuite/gdb.threads/thread-specific.exp
gdb/testsuite/gdb.threads/thread_check.exp
gdb/testsuite/gdb.threads/tls.exp
gdb/testsuite/gdb.threads/watchthreads-reorder.exp

index 343a96bc5112bb4bd7a7d4faba173b1b7e045be7..de5a901f0b1f092d4a73c92b2402f488d087fdb9 100644 (file)
@@ -53,7 +53,7 @@ with_test_prefix "compile preload library" {
     # limit this test to running when ISNATIVE is true.
     if { [gdb_compile_shlib_pthreads \
              $libsrc $libobj {debug}] != "" } then {
-       return -1
+       return
     }
 }
 
@@ -62,7 +62,7 @@ with_test_prefix "compile test executable" {
     if { [gdb_compile_pthreads \
              "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
              executable {debug}] != "" } {
-       return -1
+       return
     }
 }
 
index 4e520c5e8f22693e9b9708f3bdf724bc2e561e61..2ea8796233681fa453abbd71491099dc6709a835 100644 (file)
@@ -23,8 +23,8 @@ if {![istarget "*-*-linux*"]} {
 standard_testfile
 set executable ${testfile}
 if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     untested "failed to compile"
-     return -1
+    untested "failed to compile"
+    return
 }
 
 set corefile [core_find $binfile]
index c77ccab17ae2eb9c3174600e681f60d7682fdd1c..bb7c341a5b5b9a03462337d972445ccb95b2fddc 100644 (file)
@@ -34,7 +34,7 @@ for {set i 1} {$i <= $iterations} {incr i} {
        clean_restart ${executable}
 
        if {![runto_main]} {
-           return -1
+           return
        }
 
        set test "run till end"
index 9faa2686c76704a106d2ad84bb32ae0fbe953bec..d0465c87a4ad4e0cb3d9a8047449ccffcb3ff7c7 100644 (file)
@@ -34,7 +34,7 @@ gdb_test_multiple "info threads" "threads are supported" {
     }
     -re "\r\n$gdb_prompt $" {
        unsupported "gdb does not support threads on this target"
-       return -1
+       return
     }
 }
 
index c3b8c56dd4b949eda737a0a4116950e3e1411e09..1d0150da6745eb7966ecb1882ffd57602b71f3a5 100644 (file)
@@ -65,7 +65,7 @@ gdb_test_multiple "info threads" "threads are supported" {
     }
     -re "${nl}$gdb_prompt $" {
        unsupported "gdb does not support threads on this target"
-       return -1
+       return
     }
 }
 
@@ -83,7 +83,7 @@ gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
 set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
 
 if {!$core_supported} {
-  return -1
+    return
 }
 
 
index 42773f2293b5bce00313c1f4464c1193b97dc36e..f573964ea6a487ede2800f696f001aa94a2c3cb3 100644 (file)
@@ -99,7 +99,7 @@ for {set i 0} {$i < 5} {incr i} {
            # when it first notices that the thread library doesn't support
            # debugging, or if we could explicitly ask GDB somehow.
            unsupported "this GDB does not support threads on this system."
-           return -1
+           return
        }
        -re "$gdb_prompt $" {
        }
index 8d438673cf077a0ff50a57673ba79d60e1c185e5..fdcbaa47c7f455d7044709ee3f2d2f436304dafb 100644 (file)
 standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-  executable {debug additional_flags=-std=gnu99}] != "" } {
-  return -1
+        executable {debug additional_flags=-std=gnu99}] != "" } {
+    return
 }
 
 clean_restart "${::testfile}"
 
 if {![runto_main]} {
-   return 0
+    return
 }
 
 # Ensure that each new thread is detected by GDB in the order that the
index b561bf2f4a5b374ac0a1b0e8d460c16ff2478353..7d706078b2c46d457ec72506527a9259bc05ab12 100644 (file)
@@ -56,7 +56,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
 if {[info procs gdb_openmp_setup] != ""} {
     if {[gdb_openmp_setup $binfile] != ""} {
        untested "could not set up OpenMP environment"
-       return -1
+       return
     }
 }
 
index 636bcf98915969cce2e9d492051ef014b6c2824f..a7f39933d7449d50f4c2e1daf88e867bf99c2431 100644 (file)
@@ -30,7 +30,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
 if {[info procs gdb_openmp_setup] != ""} {
     if {[gdb_openmp_setup $binfile] != ""} {
        untested "could not set up OpenMP environment"
-       return -1
+       return
     }
 }
 
index acf1185cdfc54abe34337e9c3d8c158cf219b8a7..6b095ac968ad8023ccbf157d6d59468bd882b7e5 100644 (file)
@@ -62,7 +62,7 @@ for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
        }
     }
     if {$sigusr == ""} {
-       return -1
+       return
     }
 
     set test "signal $sigcount si_signo"
index bc36d87f7d706a8f9508f9e4894bf60e2eaf40e1..b25c0ae4e3b9bd368d277d1606ace0f6f6cfc804 100644 (file)
@@ -30,7 +30,7 @@ foreach_with_prefix have_tls { "-DHAVE_TLS" "" } {
        break
     }
     if { $have_tls == "" } {
-       return -1
+       return
     }
 }
 
@@ -99,7 +99,7 @@ clean_restart ${::testfile}
 
 if { "$have_tls" != "" } {
     if {![runto_main]} {
-       return -1
+       return
     }
     gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"]
     gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*"
index f59c6275c5d49f023f5ad236b79cef041c8f13b8..673d77f0028b5a381f7376cff19afc3b2d35d3e9 100644 (file)
@@ -85,7 +85,7 @@ gdb_test_multiple "disassemble" "" {
     -re "^End of assembler dump\\.\r\n$gdb_prompt $" {
        if { [llength $syscall_addrs] == 0 } {
            unsupported "no syscalls found"
-           return -1
+           return
        }
     }
 }
index 79932ab9dc1786ba58727da80e930d116a3695f8..a5191122b0f8410c0274c48a3b38eeaef5bd7ef1 100644 (file)
@@ -81,8 +81,8 @@ set line [gdb_get_line_number "thread-specific.exp: thread loop"]
 set threads [get_thread_list]
 
 if {[llength $threads] == 0} {
-  # We have already issued a FAIL above.
-  return 1
+    # We have already issued a FAIL above.
+    return
 }
 
 gdb_test {print $_thread} ".* = [lindex $threads 0]" "thread var in main"
index e48e3d5b3c377121586853fadbb318c5c22aa31a..013fd253e9f900b24f1517b202162279cc9ad9d0 100644 (file)
@@ -42,7 +42,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 clean_restart ${::testfile}
 
 if {![runto_main]} {
-      return 1
+    return
 }
 
 
index bf48a6f9fc9edfe9bb4c3271a8d4c603ddf5a086..96e41eed411f5041363aec458b257a411051b85a 100644 (file)
@@ -165,7 +165,7 @@ gdb_test_multiple "print a_thread_local" "" {
 }
 
 if {![runto_main]} {
-   return 0
+    return
 }
 
 # Set a breakpoint at the "spin" routine to
@@ -190,7 +190,7 @@ gdb_expect {
        # This is the first symptom if the gcc and binutils versions
        # in use support TLS, but the system glibc does not.
        unsupported "continue to first thread: system does not support TLS"
-       return -1
+       return
     }
     -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
        fail "continue to first thread: program runaway"
index f56661d7a5c2f6a9d4c55be7b02654dea02df719..192996b51ca93b56ae48e139bd8b119048d768c0 100644 (file)
@@ -42,7 +42,7 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
     gdb_test "set can-use-hw-watchpoints 1"
 
     if {![runto_main]} {
-       return -1
+       return
     }
 
     # Use "rwatch" as "watch" would report the watchpoint changed just based on its