]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, tclint] Fix gdb.threads
authorTom de Vries <tdevries@suse.de>
Sat, 20 Sep 2025 12:48:57 +0000 (14:48 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 20 Sep 2025 12:48:57 +0000 (14:48 +0200)
Running tclint on the test-cases in gdb.threads shows a few problems.

Fix these.

Tested on x86_64-linux.

71 files changed:
gdb/tclint.toml
gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
gdb/testsuite/gdb.threads/attach-into-signal.exp
gdb/testsuite/gdb.threads/attach-stopped.exp
gdb/testsuite/gdb.threads/break-while-running.exp
gdb/testsuite/gdb.threads/clone-attach-detach.exp
gdb/testsuite/gdb.threads/clone-thread_db.exp
gdb/testsuite/gdb.threads/continue-pending-after-query.exp
gdb/testsuite/gdb.threads/continue-pending-status.exp
gdb/testsuite/gdb.threads/create-fail.exp
gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
gdb/testsuite/gdb.threads/detach-step-over.exp
gdb/testsuite/gdb.threads/fork-plus-threads.exp
gdb/testsuite/gdb.threads/gcore-thread.exp
gdb/testsuite/gdb.threads/hand-call-in-threads.exp
gdb/testsuite/gdb.threads/hand-call-new-thread.exp
gdb/testsuite/gdb.threads/ia64-sigill.exp
gdb/testsuite/gdb.threads/inf-thr-count.exp
gdb/testsuite/gdb.threads/infcall-thread-announce.exp
gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
gdb/testsuite/gdb.threads/info-threads-options.exp
gdb/testsuite/gdb.threads/interrupt-while-step-over.exp
gdb/testsuite/gdb.threads/kill.exp
gdb/testsuite/gdb.threads/killed.exp
gdb/testsuite/gdb.threads/leader-exit.exp
gdb/testsuite/gdb.threads/linux-dp.exp
gdb/testsuite/gdb.threads/manythreads.exp
gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp
gdb/testsuite/gdb.threads/multiple-step-overs.exp
gdb/testsuite/gdb.threads/names.exp
gdb/testsuite/gdb.threads/next-bp-other-thread.exp
gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
gdb/testsuite/gdb.threads/non-ldr-exit.exp
gdb/testsuite/gdb.threads/non-stop-fair-events.exp
gdb/testsuite/gdb.threads/omp-par-scope.exp
gdb/testsuite/gdb.threads/print-threads.exp
gdb/testsuite/gdb.threads/process-dies-while-detaching.exp
gdb/testsuite/gdb.threads/pthread_cond_wait.exp
gdb/testsuite/gdb.threads/queue-signal.exp
gdb/testsuite/gdb.threads/schedlock-new-thread.exp
gdb/testsuite/gdb.threads/schedlock.exp
gdb/testsuite/gdb.threads/siginfo-threads.exp
gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
gdb/testsuite/gdb.threads/sigstep-threads.exp
gdb/testsuite/gdb.threads/staticthreads.exp
gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
gdb/testsuite/gdb.threads/step-over-exec.exp
gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
gdb/testsuite/gdb.threads/stepi-over-clone.exp
gdb/testsuite/gdb.threads/stepi-random-signal.exp
gdb/testsuite/gdb.threads/thread-bp-deleted.exp
gdb/testsuite/gdb.threads/thread-execl.exp
gdb/testsuite/gdb.threads/thread_check.exp
gdb/testsuite/gdb.threads/threadapply.exp
gdb/testsuite/gdb.threads/threadcrash.exp
gdb/testsuite/gdb.threads/threads-after-exec.exp
gdb/testsuite/gdb.threads/tid-reuse.exp
gdb/testsuite/gdb.threads/tls-sepdebug.exp
gdb/testsuite/gdb.threads/tls-shared.exp
gdb/testsuite/gdb.threads/tls-var.exp
gdb/testsuite/gdb.threads/tls.exp
gdb/testsuite/gdb.threads/watchpoint-fork.exp
gdb/testsuite/gdb.threads/watchthreads-reorder.exp
gdb/testsuite/gdb.threads/watchthreads.exp
gdb/testsuite/gdb.threads/watchthreads2.exp
gdb/testsuite/gdb.threads/wp-replication.exp

index a69e2b53e4a1700f3a75d7fc858c0e40a379e2dc..47c3ce459e6ca13ce808215b072cd974389535f6 100644 (file)
@@ -25,7 +25,6 @@ exclude = [
 "gdb/testsuite/gdb.cp",
 "gdb/testsuite/gdb.dwarf2",
 "gdb/testsuite/gdb.mi",
-"gdb/testsuite/gdb.threads",
 "gdb/testsuite/gdb.trace",
 # IGNORE (document reason in trailing comment):
 "gdb/testsuite/gdb.stabs", # To be removed.
index 6846b3881a2de93e5a5b305c9a7abce39439cd07..64d2f5357eb6b9abea9bc08c1118855c19de487b 100644 (file)
@@ -54,7 +54,7 @@ proc test { non_stop } {
       clean_restart ${::testfile}
     }
 
-    if ![runto setup_done] {
+    if {![runto setup_done]} {
        return -1
     }
 
@@ -101,7 +101,7 @@ proc test { non_stop } {
            #
            # Since it's reload_on_run targets that need special care,
            # we default to reusing the connection on most targets.
-           if [target_info exists gdb,do_reload_on_run] {
+           if {[target_info exists gdb,do_reload_on_run]} {
                gdb_test "add-inferior -no-connection" "New inferior 2.*"
            } else {
                gdb_test "add-inferior" "New inferior 2.*"
@@ -110,7 +110,7 @@ proc test { non_stop } {
 
            gdb_load $binfile
 
-           if ![runto setup_done] {
+           if {![runto setup_done]} {
                return -1
            }
        }
@@ -187,7 +187,7 @@ proc test { non_stop } {
 }
 
 foreach non_stop { "off" "on" } {
-    set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
+    set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
     with_test_prefix "$stop_mode" {
        test $non_stop
     }
index 06297365d945e992c3f37cc542f8bee39e6acb82..ca452c164b75df93704ceb3824c23e7281aaca08 100644 (file)
@@ -58,7 +58,7 @@ proc corefunc { threadtype executable } {
                    # nonthreaded:
                    pass $test
                    verbose -log "$test succeeded on the attempt # $attempt of $attempts"
-                   set passes [expr $passes + 1]
+                   set passes [expr {$passes + 1}]
                }
                -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
                    set ok 0
@@ -84,11 +84,11 @@ proc corefunc { threadtype executable } {
 
                    if { $ok == 0} {
                        # We just lack the luck, we should try it again.
-                       set attempt [expr $attempt + 1]
+                       set attempt [expr {$attempt + 1}]
                    } else {
                        pass $test
                        verbose -log "$test succeeded on the attempt # $attempt of $attempts"
-                       set passes [expr $passes + 1]
+                       set passes [expr {$passes + 1}]
                    }
                }
            }] != 0 } {
index a3926d94d3b93b20a143c0d52550cec022444a3e..03919149d1618dd00716bb607c843289a4c533a8 100644 (file)
@@ -40,13 +40,13 @@ proc corefunc { threadtype } {
     set test_spawn_id [spawn_wait_for_attach $binfile]
     set testpid [spawn_id_get_pid $test_spawn_id]
 
-    # Stop the program 
+    # Stop the program
     remote_exec build "kill -s STOP ${testpid}"
 
     clean_restart $::testfile
 
     # Verify that we can attach to the stopped process.
-       
+
     set test "$threadtype: attach2 to stopped, after setting file"
     gdb_test_multiple "attach $testpid" "$test" {
        -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
index fb7994d8d7cecbb1d4f3a5835becff08ee28f602..c1e1051fa08295706c3e3ed8a0f92fd3a0d8f7e9 100644 (file)
@@ -44,7 +44,7 @@ proc test { update_thread_list always_inserted non_stop } {
     gdb_test_no_output "set non-stop $non_stop"
     gdb_test_no_output "set breakpoint always-inserted $always_inserted"
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
@@ -152,8 +152,8 @@ proc test { update_thread_list always_inserted non_stop } {
 foreach update_thread_list { true false } {
     foreach always_inserted { "off" "on" } {
        foreach non_stop { "off" "on" } {
-           set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
-           set update_list_mode [expr ($update_thread_list)?"w/ithr":"wo/ithr"]
+           set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
+           set update_list_mode [expr {($update_thread_list)?"w/ithr":"wo/ithr"}]
            with_test_prefix "$update_list_mode: always-inserted $always_inserted: $stop_mode" {
                test $update_thread_list $always_inserted $non_stop
            }
index 3da2c3ed9a6a2580476dd457d491658ad9ae49d3..b0f5e5269019873ff4ecf3c16c5fc0578026ecb3 100644 (file)
@@ -19,7 +19,7 @@
 # clone as proxy for when libthread_db is not available.
 
 # This only works on targets with the Linux kernel.
-if ![istarget *-*-linux*] {
+if {![istarget *-*-linux*]} {
     return
 }
 
@@ -27,7 +27,7 @@ require can_spawn_for_attach
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
     return -1
 }
 
index 7ee233d1eae2940f3d854a5d8a4c4e7821b641ba..12349e2385c83171c9acab7bb3d620983f83548d 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # This only works on targets with the Linux kernel.
-if ![istarget *-*-linux*] {
+if {![istarget *-*-linux*]} {
     return
 }
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 5069cd2655f215b1820a9bde5d8544e24b53bbb4..1da2e233295b6881b45e08527e69d9146757723b 100644 (file)
@@ -51,7 +51,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
 proc test {} {
     global srcfile gdb_prompt
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
index 9cde85a33e7fac47595ce4f8616b6318f1db7e38..447b6833d8368b032fd9a917d57615c949a4dc5f 100644 (file)
@@ -21,11 +21,11 @@ require {!target_info exists gdb,nointerrupts}
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 14f3f4b1de6c7337a30862fd8eed9a05b8dd1f6c..5d633f98b75ae5d2b925a487d443638e1ff94baf 100644 (file)
@@ -33,7 +33,7 @@ for {set i 1} {$i <= $iterations} {incr i} {
 
        clean_restart ${executable}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
index 1fbfc4079d6a031ee4d049d3b3094bb69abc67e9..bdc519f3392a0a6827b9483dad67ccffd313a6b1 100644 (file)
@@ -44,7 +44,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
 
 gdb_locate_shlib $binfile_lib
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
index 176746417b5c835723615bd733e97a37afd641ee..98b412cfcfd520c1e33af61b70af03c9f6b79162 100644 (file)
@@ -229,7 +229,7 @@ proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop di
 
            set running_count 0
            set interrupted 0
-           set running_expected [expr ($::n_threads + 1) * 2]
+           set running_expected [expr {($::n_threads + 1) * 2}]
            gdb_test_multiple "info threads" "threads running" {
                -re "\\(running\\)" {
                    incr running_count
@@ -357,7 +357,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1}
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 4ce88d33293bcca1f81037822df4af42ce6febb1..c41b164817569df2650cc34a37831313df31c604 100644 (file)
@@ -76,7 +76,7 @@ proc do_test { detach-on-fork } {
     set saw_cannot_remove_breakpoints 0
     set saw_thread_stopped 0
 
-    set expected_num_inferior_exits [expr ${detach-on-fork} == "off" ? 11 : 1]
+    set expected_num_inferior_exits [expr {${detach-on-fork} == "off" ? 11 : 1}]
 
     # Flags indicating if we have see the exit for each inferior.
     for {set i 1} {$i <= $expected_num_inferior_exits} {incr i} {
index 4e00f80407bf45faa083c5f415bcdca05168344a..f32e9b41f9cb6ad53f705b6c068c906240924d53 100644 (file)
@@ -123,7 +123,7 @@ proc load_core { filename } {
     }
 
     # FIXME: now what can we test about the thread state?
-    # We do not know for certain that there should be at least 
+    # We do not know for certain that there should be at least
     # three threads, because who knows what kind of many-to-one
     # mapping various OS's may do?  Let's assume that there must
     # be at least two threads:
index fd934f501780b709abd2185c88340908fdb0ee6d..f9c9e87efb0478d967f7598ea22e2254f2f9f3a7 100644 (file)
@@ -74,7 +74,7 @@ gdb_test "show scheduler-locking" ".* locking scheduler .* is \"on\"." "show sch
 # stop without returning.
 
 # Add one for the main thread.
-set total_nr_threads [expr $NR_THREADS + 1]
+set total_nr_threads [expr {$NR_THREADS + 1}]
 
 # Thread numbering in gdb is origin-1, so begin numbering at 1.
 for { set i 1 } { $i <= $total_nr_threads } { incr i } {
index 6b859ff9bb8e5317a9ada9fb53f5e314cea2a706..479c2ffaef427957970e5051037cdd7dbb5ad595 100644 (file)
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return
 }
 
index ac6ff2052d6de978d1f3f442ee1fa1832b2eae15..46954defa2ae77ca50b479bb4a7c7a66cbacb255 100644 (file)
@@ -27,7 +27,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable
 
 clean_restart $testfile
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 5272f5c901aa421077f2ff4a581f5c80aae63bd6..4508be2be7f03c83e95e61b47057fc14b2f52d17 100644 (file)
@@ -47,7 +47,7 @@ save_vars {GDBFLAGS} {
     clean_restart $::testfile
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 68fd7b73d554416b5a760c543bbb893742b3ae36..59a5bcfb41806eaad7c0a49db3a6eb09a4a039e4 100644 (file)
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 2d57136ef8f2e83a0490b1ef3c424d922a484c91..784caf9956947bee202110c0ed46cb49e1a75c9e 100644 (file)
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads \
 
 clean_restart ${executable}
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index e6c68e23d9264dfdafd6580b29800b28a3760761..b322261ade93587a55aac44c4ea0980d50a68ee7 100644 (file)
@@ -27,7 +27,7 @@ save_vars { GDBFLAGS } {
     clean_restart $::testfile
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 44e4d6405e19c4be5a03f27a188977d98c1c405e..d3f328b0f55b18563699ba3a0f473cf200a000f8 100644 (file)
@@ -84,7 +84,7 @@ proc test_one_iteration {} {
            exp_continue
        }
        -re "$gdb_prompt " {
-           if ![gdb_assert $saw_continuing $test] {
+           if {![gdb_assert $saw_continuing $test]} {
                return 1
            }
        }
@@ -101,7 +101,7 @@ proc test_one_iteration {} {
            exp_continue
        }
        -re "$gdb_prompt " {
-           if ![gdb_assert {$running_count == $NUM_THREADS} $test] {
+           if {![gdb_assert {$running_count == $NUM_THREADS} $test]} {
                return 1
            }
        }
@@ -151,7 +151,7 @@ proc test_one_iteration {} {
            exp_continue
        }
        -re "$gdb_prompt " {
-           if ![gdb_assert {$running_count == 0} $test] {
+           if {![gdb_assert {$running_count == 0} $test]} {
                return 1
            }
        }
@@ -174,7 +174,7 @@ proc testdriver {displaced} {
 
     gdb_test_no_output "set displaced-stepping $displaced"
 
-    if ![runto all_started] {
+    if {![runto all_started]} {
        return
     }
     set break_line [gdb_get_line_number "set breakpoint here"]
index 3e6aa8bdb75e858453c1e7bc5a46e42d0f316654..72f829c416ce05b9c105a12eeaa6f44cbd87ca72 100644 (file)
@@ -23,7 +23,7 @@ standard_testfile
 proc test {threaded} {
     global testfile srcfile decimal
 
-    with_test_prefix [expr ($threaded)?"threaded":"non-threaded"] {
+    with_test_prefix [expr {($threaded)?"threaded":"non-threaded"}] {
 
        set options {debug}
        if {$threaded} {
index 1fa83af5be2016216338ac93f37d6c997fa362c9..635ffc83a80f43d1d6c23600c381a52b4dad7ca4 100644 (file)
@@ -29,7 +29,7 @@
 # There is absolutely no warranty for GDB.  Type "show warranty" for details.
 # This GDB was configured as "i686-pc-linux-gnu"...
 # (gdb) run
-# Starting program: /home/jimb/foo/play/killed 
+# Starting program: /home/jimb/foo/play/killed
 # [New Thread 1024 (LWP 6487)]
 # [New Thread 2049 (LWP 6488)]
 # [New Thread 1026 (LWP 6489)]
 # Cannot find thread 2049: generic error
 # (gdb) The program is running.  Exit anyway? (y or n) y
 # Cannot find thread 2049: generic error
-# (gdb) 
+# (gdb)
 # [7]+  Stopped                 $D6/gdb/gdb -nw killed
 # $ kill %7
-# 
+#
 # [7]+  Stopped                 $D6/gdb/gdb -nw killed
 # $ kill -9 %7
-# 
+#
 # [7]+  Stopped                 $D6/gdb/gdb -nw killed
-# $ 
+# $
 # [7]+  Killed                  $D6/gdb/gdb -nw killed
-# $ 
+# $
 
 
 standard_testfile
index 1bc017bad9f77faea75c5eca7b035d2efb28d8dc..85039b86b031d3175ef534ee10fa88db3e7a74ac 100644 (file)
@@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 
 clean_restart ${executable}
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 35cc255f1c758d044735c6389f0fb6340667d11d..c0ef9c7a5677894234aa46c48ce935da2e9ecbe3 100644 (file)
@@ -117,7 +117,7 @@ for {set i 0} {$i < 5} {incr i} {
     } else {
        fail "create philosopher: $i"
     }
-    
+
     set threads_after {}
     gdb_test_multiple "info threads" "info threads after: $i" {
        -re "info threads\r\n" {
@@ -172,7 +172,7 @@ for {set i 1} {$i <  $nthreads} {incr i} {
     append info_threads_ptn "$i *Thread .*"
 }
 append info_threads_ptn "\[\r\n\]+$gdb_prompt $"
-set info_threads_manager_ptn "[expr $nthreads + 1] *Thread .*$info_threads_ptn"
+set info_threads_manager_ptn "[expr {$nthreads + 1}] *Thread .*$info_threads_ptn"
 
 gdb_test_multiple "info threads" "info threads 2" {
     -re "$info_threads_manager_ptn" {
@@ -241,7 +241,7 @@ for {set i 0} {$only_five > 0 && $i < 10} {incr i} {
        -re ".*$gdb_prompt $" {
            set only_five 0
        }
-       timeout { 
+       timeout {
            set only_five -1
        }
     }
@@ -331,7 +331,7 @@ set any_interesting 0
 catch {unset seen}
 array set seen {}
 for {set i 1} {$i <= $nthreads} {incr i} {
-    if [check_philosopher_stack $i seen] {
+    if {[check_philosopher_stack $i seen]} {
        set any_interesting 1
     }
 }
index 2cd296f31515ce171918c671025caecbe614609e..0a09897f22b5876d8678a101f8da5e478fa74bcb 100644 (file)
@@ -22,7 +22,7 @@ require {!target_info exists gdb,nointerrupts}
 standard_testfile
 
 set opts { debug }
-if [info exists DEBUG] {
+if {[info exists DEBUG]} {
     # make check RUNTESTFLAGS='gdb.threads/manythreads.exp DEBUG=1'
     lappend opts "additional_flags=-DDEBUG"
 }
index 1c3231cea26e986b46e38295fe911d4a006bc96c..c42c1a9659a622fa7f4c87ac5cfc581aaae78fbe 100644 (file)
@@ -25,7 +25,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
 gdb_test_no_output "set pagination off"
 gdb_test_no_output "set non-stop on"
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 84eef1a8c34f43dc4b71aec3db13ca9679fbd877..c3456c250459fbfcfa4d7139c98773c775986163 100644 (file)
@@ -35,7 +35,7 @@ proc setup {} {
     with_test_prefix "setup" {
        clean_restart $executable
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
index 6f38c4e32b927c6942f2ef9ea6d2d16dcc661286..808fa2406eb839a1e90beff0d41ec401c50900d7 100644 (file)
@@ -20,11 +20,11 @@ require {!target_info exists gdb,no_thread_names}
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
     return -1
 }
 
-if ![runto "all_threads_ready"] {
+if {![runto "all_threads_ready"]} {
     return
 }
 
index 6b696ddf4558403ba6807aa846de4e1e3ac9c140..293b10011fc5e52ae152f065000b9967f09fe117 100644 (file)
@@ -30,7 +30,7 @@ foreach schedlock {"off" "step" "on" } {
     with_test_prefix "schedlock=$schedlock" {
        clean_restart $::testfile
 
-       if ![runto_main] {
+       if {![runto_main]} {
            continue
        }
 
index edeabaf7986a79b5e89051f09405f6288a2f065d..96b5433ac67d42fc9b1746ef7131be631c78b0fe 100644 (file)
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
 
 clean_restart ${executable}
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 846fe89ee95d5fa8c525e85293e0be6dec0ece4a..7d2956d69047c66d6f492c5ba2163123ee042f83 100644 (file)
@@ -31,7 +31,7 @@ proc do_test { lock_sched nonstop } {
       clean_restart ${executable}
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
index 860b6b52976788a3a9c0c90c576fb385918b00c6..bb666446c6872e12ea2031aa72b65bfaf791e8d8 100644 (file)
@@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } {
       clean_restart ${executable}
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
index b50bfac824ea6dae1b628cd6cfd98e1dd3c4b351..4490b30efc77b5851b28b324a920bff1d9031899 100644 (file)
@@ -34,7 +34,7 @@ proc do_test { lock_sched nonstop } {
       clean_restart ${executable}
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
index 9892d83a29e941253cf331f213748a66d37d89c8..533e14f1e6ab6c61505b4dac5a24cca762cfeea5 100644 (file)
@@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } {
       clean_restart ${executable}
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
index b09a37ed310c7356b796cafd7aec1cd979df3d13..4dd1b79fb7c4629d5023154f74e57156a0d07677 100644 (file)
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 5def610a85a1023451492c7374eccc1c8d5770d1..788a7e8c1723de3120f0f4184432d67c1ab521e6 100644 (file)
@@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1}
 
 gdb_test_no_output "set non-stop on"
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 27dbaf0d5e974bb71c46a9a1304aba8a5efb21e9..2a097f5b7389c1828b02e12e8b66050eaadc4cb6 100644 (file)
@@ -30,7 +30,7 @@ if { [test_compiler_info "clang*"] } {
 
 set have_nested_function_support 0
 set opts {openmp debug}
-if [support_nested_function_tests] {
+if {[support_nested_function_tests]} {
     lappend opts "additional_flags=-DHAVE_NESTED_FUNCTION_SUPPORT"
     set have_nested_function_support 1
 }
@@ -191,7 +191,7 @@ with_test_prefix "multi_scope" {
 # Nested functions in C are a GNU extension, so only do the nested function
 # tests if compiling with -DHAVE_NESTED_FUNCTION_SUPPORT was successful.
 
-if $have_nested_function_support {
+if {$have_nested_function_support} {
     with_test_prefix "nested_func" {
        gdb_breakpoint [gdb_get_line_number "nested_func: tn="]
 
index 3d2dc1493bdaf05597712765db0e08d460f8f7cc..a3fcba3436f42461851795cfcf408340f72c3e9f 100644 (file)
@@ -50,13 +50,13 @@ proc test_all_threads { name kill } {
        set j 0
        gdb_test_multiple "continue" "all threads ran once" {
            -re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" {
-               set i [expr $i + 1]
+               set i [expr {$i + 1}]
                pass "hit thread_function breakpoint, $i"
                send_gdb "continue\n"
                exp_continue
            }
            -re "Breakpoint \[0-9\]+, .* kill \\(.*\\) .*$gdb_prompt" {
-               set j [expr $j + 1]
+               set j [expr {$j + 1}]
                if { $kill == 1 } {
                    pass "hit kill breakpoint, $j"
                } else {
@@ -96,7 +96,7 @@ runto_main
 gdb_test "break thread_function" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*print-threads.c, line \[0-9\]*\\." "break thread_function, 2"
 gdb_test_no_output "set var slow = 1"
 # Extend the timeout for slower tests.
-set timeout [expr $oldtimeout + 120]
+set timeout [expr {$oldtimeout + 120}]
 test_all_threads "slow" 0
 set timeout $oldtimeout
 
@@ -105,6 +105,6 @@ gdb_test "break thread_function" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*p
 gdb_test_no_output "set var slow = 1" "set var slow = 1, 2"
 gdb_breakpoint "kill"
 # Extend the timeout for slower tests.
-set timeout [expr $oldtimeout + 120]
+set timeout [expr {$oldtimeout + 120}]
 test_all_threads "slow with kill breakpoint" 1
 set timeout $oldtimeout
index 6c6a4b1938dda713711d6afef1ad3a34a07bcc1d..63ddfecde3d03e174c3ca4c165bf94a3bb3f5b08 100644 (file)
@@ -188,7 +188,7 @@ proc do_detach {multi_process cmd child_exit} {
            perror "unhandled command: $cmd"
        }
     } else {
-       if $is_remote {
+       if {$is_remote} {
            set extra "\r\nEnding remote debugging\."
        } else {
            set extra ""
@@ -217,7 +217,7 @@ proc test_detach {multi_process cmd} {
 
        clean_restart ${::testfile}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
@@ -245,7 +245,7 @@ proc test_detach_watch {wp multi_process cmd} {
 
        clean_restart ${::testfile}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
@@ -293,7 +293,7 @@ proc test_detach_killed_outside {multi_process cmd} {
 
        clean_restart ${::testfile}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
index e914db054edd32592bf7ef454baada6d68b1068b..e11b9043a2e6fd0c3a9dfcd16c8290a8f6b50c2d 100644 (file)
@@ -17,7 +17,7 @@
 # bug-gdb@gnu.org
 
 # This file verifies that GDB is able to compute a backtrace for a thread
-# being blocked on a call to pthread_cond_wait(). 
+# being blocked on a call to pthread_cond_wait().
 
 standard_testfile
 
@@ -36,7 +36,7 @@ gdb_test "continue" \
          ".*Breakpoint 2, break_me ().*" \
          "run to break_me"
 
-# 
+#
 # Backtrace all threads, find the one running noreturn, and
 # verify that we are able to get a sensible backtrace, including
 # the frame for the pthread_cond_wait() call.
index 34abc3b8dd0fb793831eaa8b237cc3239f88db5b..6ab8bbbf41c9a4e78ce4559ae387ebda6d1ddaec 100644 (file)
@@ -22,7 +22,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 
 clean_restart ${::testfile}
 
-if ![runto_main] {
+if {![runto_main]} {
    return 0
 }
 
index 5fda4b8859a05080392246456a56887ddb323977..0937e2a1bd1b82db6526d303308b0daec6199c76 100644 (file)
@@ -18,7 +18,7 @@
 standard_testfile .c
 
 foreach_with_prefix schedlock {off on} {
-    set sl [expr $schedlock == "on" ? 1 : 0]
+    set sl [expr {$schedlock == "on" ? 1 : 0}]
     if { [build_executable "failed to prepare" $testfile-$sl \
              $srcfile \
              [list debug pthreads additional_flags=-DSCHEDLOCK=$sl]] \
@@ -30,7 +30,7 @@ foreach_with_prefix schedlock {off on} {
 proc test {non-stop schedlock} {
     save_vars ::GDBFLAGS {
        append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
-       set sl [expr $schedlock == "on" ? 1 : 0]
+       set sl [expr {$schedlock == "on" ? 1 : 0}]
        clean_restart $::testfile-$sl
     }
 
index 4e2b835057f0a584949f375e4024c70be6554704..125786823ea4806b30b7d70d812e1620bb3c8f6f 100644 (file)
@@ -41,7 +41,7 @@ proc get_args { description } {
     global NUM
 
     set pattern "(\[0-9\]+)"
-    for {set i 1} {[expr $i < $NUM]} {incr i} {
+    for {set i 1} {$i < $NUM} {incr i} {
        append pattern ", (\[0-9\]+)"
     }
 
@@ -51,7 +51,7 @@ proc get_args { description } {
            pass $test
 
            set result ""
-           for {set i 1} {[expr $i <= $NUM]} {incr i} {
+           for {set i 1} {[expr {$i <= $NUM}]} {incr i} {
                lappend result $expect_out($i,string)
            }
            return $result
@@ -122,7 +122,7 @@ proc my_continue { msg } {
 proc step_ten_loops { cmd } {
     global gdb_prompt
 
-    for {set i 0} {[expr $i < 10]} {set i [expr $i + 1]} {
+    for {set i 0} {$i < 10} {incr i} {
        set other_step 0
        set test "$cmd to increment, $i"
        gdb_test_multiple $cmd $test {
@@ -183,7 +183,7 @@ my_continue "initial"
 set cont_args [get_args "after initial"]
 
 set bad 0
-for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
+for {set i 0} {$i < $NUM} {incr i} {
   if {[lindex $start_args $i] == [lindex $cont_args $i]} {
     incr bad
   }
@@ -233,7 +233,7 @@ proc check_result { cmd before_thread before_args locked } {
        } else {
            if {$i == $before_thread} {
                if {$cmd == "continue"
-                   || [lindex $before_args $i] == [expr [lindex $after_args $i] - 10]} {
+                   || [lindex $before_args $i] == [lindex $after_args $i] - 10} {
                    pass "$test"
                } else {
                    fail "$test (wrong amount)"
index ecc372d84087332b30cf33c5419d45dab7dfabb9..253c4c03406f63f1db7b8a5f644153884e60d38b 100644 (file)
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \
 
 clean_restart $testfile
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index e2f758106dd29b729fbe62a707b41ba343381180..b7a110d5799926addcad5e338a109bb14bb7e81c 100644 (file)
@@ -51,7 +51,7 @@ proc get_value {var test} {
 
 clean_restart $executable
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 0580cd0cb9d3105844377144c2f10ecd665b5709..9aed9e3303eb66f863903215e7c6aaff04eda17b 100644 (file)
@@ -23,7 +23,7 @@ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executa
 
 clean_restart $executable
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
@@ -65,7 +65,7 @@ for {set i 0} {$i < 100} {incr i} {
            set step_at $now
        }
     }
-    if $failed {
+    if {$failed} {
        return
     }
 }
index bbe11abf8f38290967d046d03041a63075b48fd4..44cc6865ae0c937a0d9df9b265d8463bc1bd72d0 100644 (file)
@@ -51,7 +51,7 @@ gdb_test_multiple "continue" "$test" {
        kfail gdb/1328 "$test"
     }
 }
-    
+
 
 # See if handle SIG32 helps (a little) with a static multi-threaded
 # program.
@@ -59,7 +59,7 @@ gdb_test_multiple "continue" "$test" {
 set sig "SIG32"
 
 # SIGRTMIN is 37 on hppa-linux
-if [istarget hppa*-*-*] {
+if {[istarget hppa*-*-*]} {
   set sig "SIG37"
 }
 
@@ -98,7 +98,7 @@ clean_restart ${::testfile}
 
 
 if { "$have_tls" != "" } {
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
     gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"]
index 309c8269b395854e1961ca26f57b4b86e88e41ad..82861a93cf0e4ca80b061d78ab8a6868bcb3c936 100644 (file)
@@ -34,7 +34,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return
 }
 
@@ -55,7 +55,7 @@ gdb_test_no_output "next&" "next& over inf loop"
 set test "switch to main thread"
 gdb_test_multiple "thread 1" $test {
     -re "Cannot execute this command while the target is running.*$gdb_prompt $" {
-       
+
        # With remote targets, we can't send any other remote packet
        # until the target stops.  Switching thread wants to ask the
        # remote side whether the thread is alive.
index b06f3a479e3d30cebed2465357d38bf00ae61a09..22b9a1352e22b5072f2a67d0812de41a980e44df 100644 (file)
@@ -76,7 +76,7 @@ proc do_test { execr_thread different_text_segments displaced_stepping } {
 
     gdb_test_no_output "set displaced-stepping $displaced_stepping"
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return
     }
 
index 65aa2f14a604a8f366d4f48332b51a50da36d626..3a96e0e3e9d712afdac101202152364209eb6045 100644 (file)
@@ -32,7 +32,7 @@ proc do_test {displaced command} {
     with_test_prefix "displaced=$displaced: $command" {
        clean_restart $executable
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return
        }
 
index 9a028fead1902f86042242bf9056c676ded7f6a0..0e996569e2377ce38db54ec6de71255d0166b84a 100644 (file)
@@ -38,7 +38,7 @@ proc do_test { displaced with_bp } {
     global gdb_prompt
     global hex
 
-    if ${with_bp} {
+    if {${with_bp}} {
        set prefix "with thread-specific bp"
     } else {
        set prefix "no thread-specific bp"
@@ -49,7 +49,7 @@ proc do_test { displaced with_bp } {
            with_test_prefix $command {
                clean_restart $executable
 
-               if ![runto_main] {
+               if {![runto_main]} {
                    continue
                }
 
@@ -106,7 +106,7 @@ proc do_test { displaced with_bp } {
                gdb_test "p watch_me = 0" " = 0" "clear watch_me"
                gdb_test "watch watch_me" "Hardware watchpoint .*"
 
-               if ${with_bp} {
+               if {${with_bp}} {
                    gdb_test "b *$after_address_triggers_watch thread 1" \
                        "Breakpoint .*" \
                        "set breakpoint specific to thread 1"
index d6f1680900ff98268eb4e0c10da77893ad18cdf9..e0b14cbbd4ce363416e6de263654869c39956d87 100644 (file)
@@ -58,8 +58,8 @@ gdb_test "continue" \
 # Return true if INSN is a syscall instruction.
 
 proc is_syscall_insn { insn } {
-    if [istarget x86_64-*-* ] {
-       return { $insn == "syscall" }
+    if {[istarget x86_64-*-* ]} {
+       return [string equal $insn "syscall"]
     } else {
        error "port me"
     }
@@ -76,7 +76,7 @@ gdb_test_multiple "disassemble" "" {
     -re "^(?:=>)?\\s+(${hex})\\s+<\\+${decimal}>:\\s+(\[^\r\n\]+)\r\n" {
        set addr $expect_out(1,string)
        set insn [string trim $expect_out(2,string)]
-       if [is_syscall_insn $insn] {
+       if {[is_syscall_insn $insn]} {
            verbose -log "Found a syscall at: $addr"
            lappend syscall_addrs $addr
        }
index 8ac81e8b3c439c6bd9d3bf1099f41e63ee152320..a2d7743f1539be011b6af2274be0f17885215d1e 100644 (file)
@@ -31,7 +31,7 @@ if { [gdb_compile_pthreads \
 clean_restart $executable
 
 # Start the second thread.
-if ![runto start] {
+if {![runto start]} {
     return -1
 }
 
index 80012299d99f1588d88103e7cd4223db1fb333b7..19b50018088458f066f9b4fa162934c2b4c4dfcf 100644 (file)
@@ -31,9 +31,10 @@ if {[build_executable "failed to prepare" $testfile $srcfile \
 
 # We need to do things a little differently when using the remote protocol.
 set is_remote \
-    [expr [target_info exists gdb_protocol] \
-        && ([string equal [target_info gdb_protocol] "remote"] \
-            || [string equal [target_info gdb_protocol] "extended-remote"])]
+    [expr \
+        {[target_info exists gdb_protocol]
+            && ([string equal [target_info gdb_protocol] "remote"]
+                || [string equal [target_info gdb_protocol] "extended-remote"])}]
 
 # This test requires background execution, which relies on non-stop mode.
 save_vars { GDBFLAGS } {
index 13a6ef4f37872edd12f134f8118062f683936de0..d1c80df918922d7bc6484abd33a2275ceb6c6ce8 100644 (file)
@@ -41,7 +41,7 @@ proc do_test { schedlock } {
            gdb_test_no_output "set non-stop 1"
        }
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return 0
        }
 
index 9f92066bddd89a3bfdc423fed4fd42931f099049..6378e8a8cc81c0ccb74ad7020abba610702a24fe 100644 (file)
 
 # This file was written by Manoj Iyer. (manjo@austin.ibm.com)
 # Test break points and single step on thread functions.
-# 
+#
 # Test Purpose:
-# - Test that breakpoints, continue in a threaded  application works. 
+# - Test that breakpoints, continue in a threaded  application works.
 #   On powerpc64-unknown-linux-gnu system, running kernel version
 #   2.6.5-7.71-pseries64 this test is known to fail due to kernel bug
 #   in ptrace system call.
 #
 # Test Strategy:
 # - thread_check.c creates 2 threads
-# - start gdb 
+# - start gdb
 # - create 2 breakpoints #1 main() #2 tf() (the thread function)
 # - run gdb till #1 main() breakpoint is reached
 # - continue to breakpoint #2 tf()
@@ -62,7 +62,7 @@ gdb_test "continue" \
      ".*Breakpoint 2,.*tf.*at.*$srcfile:.*" \
      "continue to tf"
 
-#   
+#
 # backtrace from thread function.
 #
 gdb_test "backtrace" \
index 34de56194f6cddc436173eac1ba93a94e38629a4..de264b66276ab7d1ec4ad92358c7aae9fd3473cc 100644 (file)
@@ -60,7 +60,7 @@ gdb_test "thread apply all backthread" "Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*
 # Go into the thread_function to check that a simple "thread apply"
 # does not change the selected frame.
 gdb_test "step" "thread_function.*" "step to the thread_function"
-gdb_test "up" ".*in main.*" "go up in the stack frame" 
+gdb_test "up" ".*in main.*" "go up in the stack frame"
 gdb_test "thread apply all print 1"  "Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1" "run a simple print command on all threads"
 gdb_test "down" "#0.*thread_function.*" "go down and check selected frame"
 
@@ -75,7 +75,7 @@ proc thr_apply_detach {thread_set} {
 
        clean_restart ${::testfile}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return -1
        }
 
@@ -104,7 +104,7 @@ proc kill_and_remove_inferior {thread_set} {
 
     # The test starts multiple inferiors, therefore non-extended
     # remote is not supported.
-    if [use_gdb_stub] {
+    if {[use_gdb_stub]} {
        unsupported "using gdb stub"
        return
     }
index 8df857868aaee21f379e1f0d47a566a1a3ba7a20..d57f437ff6a0787bcd1446988522066ee07f0e98 100644 (file)
@@ -134,7 +134,7 @@ proc do_full_test {} {
 
     set loop_iterations [llength $test_list]
     for {set i 0} {$i < $loop_iterations } {incr i} {
-       set thread_num [expr $loop_iterations - $i]
+       set thread_num [expr {$loop_iterations - $i}]
 
        set type [lindex $test_list $i]
        if { $type == 1 } {
@@ -271,8 +271,8 @@ proc_with_prefix test_gcore {} {
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
-    {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+        {debug pthreads}]} {
     return -1
 }
 
index db26315855d8b7fa8b882441e95d6667dae3e5c0..a6a3fb7bf5e1e726d419a410bcd4099ddfeed87e 100644 (file)
 standard_testfile .c
 
 proc do_test { } {
-    if [prepare_for_testing "failed to prepare" $::testfile $::srcfile {debug pthreads}] {
+    if {[prepare_for_testing "failed to prepare" $::testfile $::srcfile {debug pthreads}]} {
        return -1
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return
     }
 
index 67621277ac088a9d01b5d21c5ab0a7ed7b88eb0c..ca5edc14268e6652c5c2bd74e96cb3a93762811a 100644 (file)
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile { debug pthreads
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
@@ -72,6 +72,6 @@ delete_breakpoints
 gdb_breakpoint "after_reuse_time"
 
 # Higher than what the test program sleeps before exiting.
-set timeout [expr $reuse_time * 2]
+set timeout [expr {$reuse_time * 2}]
 
 gdb_continue_to_breakpoint "after_reuse_time"
index 6f3c711e8d3c4fceb0d607a6a224102f0d1376ad..fb684c9d16b8252e83b3e99964bf0b1deb65b9b1 100644 (file)
@@ -83,7 +83,7 @@ foreach library_path [list $absdir [relative_filename [pwd] $absdir]] \
 
        gdb_load ${binmainfile}
 
-       if ![runto_main] {
+       if {![runto_main]} {
            return
        }
 
index b7fa965f6ff41e2cf732f379bf949b1314ece2b6..66dd52fe5142ca13c14ef964bc8a4e3fda1c8ce3 100644 (file)
@@ -52,6 +52,6 @@ gdb_test "break $line_number" \
 gdb_test "continue" \
        "main .* at .*:.*return 0.*break here to check result.*" \
         "continue to break"
-# This is more of a gcc/glibc test, really. 
+# This is more of a gcc/glibc test, really.
 #
 gdb_test "print result" "3"
index de74bd97eb4a88d9dace435a583f500f113c4df8..8d8b82ef5ab39d0c086866ac0dfd1a04d5c56720 100644 (file)
@@ -27,7 +27,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != "
 
 clean_restart ${executable}
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
index 4b433871eb72e055fc245276ddb1963bfdd849ac..3dbc802d82d7801a01905ada8b09a57574770b8c 100644 (file)
@@ -56,7 +56,7 @@ proc get_me_variable {tnum} {
            fail "$tnum thread print me"
        }
        timeout {
-           fail "$tnum thread print me (timeout)" 
+           fail "$tnum thread print me (timeout)"
        }
     }
     return ${value_of_me}
@@ -116,8 +116,8 @@ proc select_thread {thread} {
 
 ### Do a backtrace for the current thread, and check that the 'spin' routine
 ### is in it. This means we have one of the threads we created, rather
-### than the main thread. Record the thread in the spin_threads 
-### array. Also remember the level of the 'spin' routine in the backtrace, for 
+### than the main thread. Record the thread in the spin_threads
+### array. Also remember the level of the 'spin' routine in the backtrace, for
 ### later use.
 proc check_thread_stack {number spin_threads spin_threads_level} {
     global gdb_prompt
@@ -148,7 +148,7 @@ proc check_thread_stack {number spin_threads spin_threads_level} {
         pass "backtrace of thread number $number not relevant"
        }
        timeout {
-           fail "backtrace of thread number $number (timeout)" 
+           fail "backtrace of thread number $number (timeout)"
        }
     }
 }
@@ -169,7 +169,7 @@ if {![runto_main]} {
 }
 
 # Set a breakpoint at the "spin" routine to
-# test the thread local's value.  
+# test the thread local's value.
 #
 gdb_test "b [gdb_get_line_number "here we know tls value"]" \
          ".*Breakpoint 2.*tls.*"   "set breakpoint at all threads"
@@ -247,7 +247,7 @@ array set spin_threads_level {}
 unset spin_threads_level
 
 # For each thread check its backtrace to see if it is stopped at the
-# spin routine. 
+# spin routine.
 for {set i 1} {$i <= $no_of_threads} {incr i} {
     check_thread_stack $i spin_threads spin_threads_level
 }
@@ -268,7 +268,7 @@ foreach i [array names spin_threads] {
       # any intermediate point in spin, too, but that is much less
       # likely.
       gdb_test "up $level" ".*spin.*sem_(wait|post).*" "thread $i up"
-      check_thread_local $i 
+      check_thread_local $i
     }
 }
 
@@ -278,7 +278,7 @@ if {$thrs_in_spin == 0} {
 
 gdb_test "continue" ".*Breakpoint 4.*before exit.*" "threads exited"
 
-send_gdb "info thread\n" 
+send_gdb "info thread\n"
 gdb_expect {
     -re ".* 1 *${tdlabel_re}.*2 *${tdlabel_re}.*$gdb_prompt $" {
         fail "too many threads left at end"
index 8e9b1c33c9bc9eea14e028f054427d7eae849fa0..68fc99e21b740c62297b5e6cd0d5946bc8e94923 100644 (file)
@@ -69,7 +69,7 @@ proc test {type symbol} {
            # Testcase uses it for the `follow-fork-mode child' type.
            gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
 
-           if ![runto_main] {
+           if {![runto_main]} {
                return
            }
 
@@ -126,7 +126,7 @@ proc test {type symbol} {
            # Testcase uses it for the `follow-fork-mode child' type.
            gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
 
-           if ![runto_main] {
+           if {![runto_main]} {
                return
            }
 
@@ -165,7 +165,7 @@ proc test {type symbol} {
 test parent FOLLOW_PARENT
 
 # Only GNU/Linux is known to support `set follow-fork-mode child'.
-if [istarget "*-*-linux*"] {
+if {[istarget "*-*-linux*"]} {
     test child FOLLOW_CHILD
 } else {
     untested "${testfile}: child"
index 5d98913255355fb803b3c386558d71ac4d9d4183..067986abb61b51fd13fca1c66c19c438caa485a4 100644 (file)
@@ -41,7 +41,7 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
 
     gdb_test "set can-use-hw-watchpoints 1"
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return -1
     }
 
@@ -72,7 +72,7 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
             "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \
             "continue a"
 
-    if $reorder {
+    if {$reorder} {
        # GDB orders watchpoints by their addresses so inserting new variables
        # with lower addresses will shift the former watchpoints to higher
        # debug registers.
index f3ec7f4c1e8327a6bcbaea61f7e1421a9e45e0c7..e2d629def46e33e8cf9e664e9c903574cf8a57db 100644 (file)
@@ -67,11 +67,11 @@ for {set i 0} {$i < 30} {incr i} {
        # At least one hardware watchpoint was hit.  Check if both were.
        set string $expect_out(1,string)
 
-       if [regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_0\[^\r\]*\r\[^\r\]*New value = [expr $args_0+1]\r" $string] {
+       if {[regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_0\[^\r\]*\r\[^\r\]*New value = [expr {$args_0+1}]\r" $string]} {
            incr args_0
            incr test_flag_0
        }
-       if [regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_1\[^\r\]*\r\[^\r\]*New value = [expr $args_1+1]\r" $string] {
+       if {[regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_1\[^\r\]*\r\[^\r\]*New value = [expr {$args_1+1}]\r" $string]} {
            incr args_1
            incr test_flag_1
        }
@@ -97,7 +97,7 @@ for {set i 0} {$i < 30} {incr i} {
            }
        }
 
-       if [ regexp "$expected_loc" $string ] {
+       if {[ regexp "$expected_loc" $string ]} {
            set test_flag 1
        } else {
            fail "threaded watch loop"
@@ -140,23 +140,23 @@ if { $test_flag == 1 } {
 # Verify that we hit first watchpoint in main thread.
 set message "first watchpoint on args\[0\] hit"
 if { $args_0 > 0 } {
-  pass $message 
+  pass $message
 } else {
-  fail $message 
+  fail $message
 }
 
 # Verify that we hit second watchpoint in main thread.
 set message "first watchpoint on args\[1\] hit"
 if { $args_1 > 0 } {
-  pass $message 
+  pass $message
 } else {
-  fail $message 
+  fail $message
 }
 
 # Verify that we hit first watchpoint in child thread.
 set message "watchpoint on args\[0\] hit in thread"
 if { $args_0 > 1 } {
-  pass $message 
+  pass $message
 } else {
   fail $message
 }
@@ -164,9 +164,9 @@ if { $args_0 > 1 } {
 # Verify that we hit second watchpoint in child thread.
 set message "watchpoint on args\[1\] hit in thread"
 if { $args_1 > 1 } {
-  pass $message 
+  pass $message
 } else {
-  fail $message 
+  fail $message
 }
 
 # Verify that all watchpoint hits are accounted for.
@@ -174,12 +174,12 @@ set message "combination of threaded watchpoints = 30"
 if { [target_no_stopped_data] } {
     # See above.  If we allow two watchpoints to be hit at once, we
     # may have more than 30 hits total.
-    set result [expr $args_0 + $args_1 >= 30]
+    set result [expr {$args_0 + $args_1 >= 30}]
 } else {
-    set result [expr $args_0 + $args_1 == 30]
+    set result [expr {$args_0 + $args_1 == 30}]
 }
 if { $result } {
-  pass $message 
+  pass $message
 } else {
-  fail $message 
+  fail $message
 }
index 19a60e47ddd32a219356d91b20869a185bda7eb5..a31c1a74f0a40fde7e4e7ef87141f07b868e6e91 100644 (file)
@@ -89,7 +89,7 @@ set x_thread_loc "thread_function \\\(arg=.*\\\) at .*watchthreads.c:$x_inc_line
 
 # X is incremented under a mutex, so we should get NR_THREADS * X_INCR_COUNT
 # hits.
-set limit [expr $NR_THREADS*$X_INCR_COUNT]
+set limit [expr {$NR_THREADS*$X_INCR_COUNT}]
 set x_count 0
 set done 0
 
@@ -102,7 +102,7 @@ for {set i 0} {!$done && $i < $limit} {incr i} {
        -re "(.*Hardware watchpoint.*)$gdb_prompt $" {
            set string $expect_out(1,string)
 
-           if [regexp "Hardware watchpoint 3: x\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $x_count\[^\r\]*\r\[^\r\]*New value = [expr $x_count+1]\r" $string] {
+           if {[regexp "Hardware watchpoint 3: x\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $x_count\[^\r\]*\r\[^\r\]*New value = [expr {$x_count+1}]\r" $string]} {
                incr x_count
                set test_flag 1
            } else {
index 8a5f95d6b51758828827051414bc3156bc26c10f..1b63d572b65f69604501b241d18363ad1c6fd9e9 100644 (file)
@@ -126,7 +126,7 @@ gdb_test_no_output "set var test_ready=1" \
       "set var test_ready=1"
 
 # Set the number of expected watchpoint triggers.
-set TRIGGERS [expr "$NR_THREADS * $hwatch_count * $NR_TRIGGERS_PER_THREAD"]
+set TRIGGERS [expr {$NR_THREADS * $hwatch_count * $NR_TRIGGERS_PER_THREAD}]
 
 # Move the threads and hit the watchpoints TRIGGERS times.
 for { set i 1 } { $i <= $TRIGGERS } { incr i } {