From: Tom de Vries Date: Sat, 20 Sep 2025 12:48:57 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.threads X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57389cbcb24efb940a466e85e0cabd897ff3e47e;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.threads Running tclint on the test-cases in gdb.threads shows a few problems. Fix these. Tested on x86_64-linux. --- diff --git a/gdb/tclint.toml b/gdb/tclint.toml index a69e2b53e4a..47c3ce459e6 100644 --- a/gdb/tclint.toml +++ b/gdb/tclint.toml @@ -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. diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp index 6846b3881a2..64d2f5357eb 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp index 06297365d94..ca452c164b7 100644 --- a/gdb/testsuite/gdb.threads/attach-into-signal.exp +++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp @@ -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 } { diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp index a3926d94d3b..03919149d16 100644 --- a/gdb/testsuite/gdb.threads/attach-stopped.exp +++ b/gdb/testsuite/gdb.threads/attach-stopped.exp @@ -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 $" { diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp index fb7994d8d7c..c1e1051fa08 100644 --- a/gdb/testsuite/gdb.threads/break-while-running.exp +++ b/gdb/testsuite/gdb.threads/break-while-running.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.exp b/gdb/testsuite/gdb.threads/clone-attach-detach.exp index 3da2c3ed9a6..b0f5e526901 100644 --- a/gdb/testsuite/gdb.threads/clone-attach-detach.exp +++ b/gdb/testsuite/gdb.threads/clone-attach-detach.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/clone-thread_db.exp b/gdb/testsuite/gdb.threads/clone-thread_db.exp index 7ee233d1eae..12349e2385c 100644 --- a/gdb/testsuite/gdb.threads/clone-thread_db.exp +++ b/gdb/testsuite/gdb.threads/clone-thread_db.exp @@ -16,17 +16,17 @@ # along with this program. If not, see . # 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 } diff --git a/gdb/testsuite/gdb.threads/continue-pending-after-query.exp b/gdb/testsuite/gdb.threads/continue-pending-after-query.exp index 5069cd2655f..1da2e233295 100644 --- a/gdb/testsuite/gdb.threads/continue-pending-after-query.exp +++ b/gdb/testsuite/gdb.threads/continue-pending-after-query.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/continue-pending-status.exp b/gdb/testsuite/gdb.threads/continue-pending-status.exp index 9cde85a33e7..447b6833d83 100644 --- a/gdb/testsuite/gdb.threads/continue-pending-status.exp +++ b/gdb/testsuite/gdb.threads/continue-pending-status.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/create-fail.exp b/gdb/testsuite/gdb.threads/create-fail.exp index 14f3f4b1de6..5d633f98b75 100644 --- a/gdb/testsuite/gdb.threads/create-fail.exp +++ b/gdb/testsuite/gdb.threads/create-fail.exp @@ -33,7 +33,7 @@ for {set i 1} {$i <= $iterations} {incr i} { clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp index 1fbfc4079d6..bdc519f3392 100644 --- a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp +++ b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp index 176746417b5..98b412cfcfd 100644 --- a/gdb/testsuite/gdb.threads/detach-step-over.exp +++ b/gdb/testsuite/gdb.threads/detach-step-over.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp index 4ce88d33293..c41b1648175 100644 --- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp +++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp @@ -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} { diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 4e00f80407b..f32e9b41f9c 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -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: diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp index fd934f50178..f9c9e87efb0 100644 --- a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp +++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp @@ -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 } { diff --git a/gdb/testsuite/gdb.threads/hand-call-new-thread.exp b/gdb/testsuite/gdb.threads/hand-call-new-thread.exp index 6b859ff9bb8..479c2ffaef4 100644 --- a/gdb/testsuite/gdb.threads/hand-call-new-thread.exp +++ b/gdb/testsuite/gdb.threads/hand-call-new-thread.exp @@ -18,11 +18,11 @@ 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 } diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.exp b/gdb/testsuite/gdb.threads/ia64-sigill.exp index ac6ff2052d6..46954defa2a 100644 --- a/gdb/testsuite/gdb.threads/ia64-sigill.exp +++ b/gdb/testsuite/gdb.threads/ia64-sigill.exp @@ -27,7 +27,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/inf-thr-count.exp b/gdb/testsuite/gdb.threads/inf-thr-count.exp index 5272f5c901a..4508be2be7f 100644 --- a/gdb/testsuite/gdb.threads/inf-thr-count.exp +++ b/gdb/testsuite/gdb.threads/inf-thr-count.exp @@ -47,7 +47,7 @@ save_vars {GDBFLAGS} { clean_restart $::testfile } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/infcall-thread-announce.exp b/gdb/testsuite/gdb.threads/infcall-thread-announce.exp index 68fd7b73d55..59a5bcfb418 100644 --- a/gdb/testsuite/gdb.threads/infcall-thread-announce.exp +++ b/gdb/testsuite/gdb.threads/infcall-thread-announce.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp index 2d57136ef8f..784caf99569 100644 --- a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp +++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp @@ -25,7 +25,7 @@ if {[gdb_compile_pthreads \ clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/info-threads-options.exp b/gdb/testsuite/gdb.threads/info-threads-options.exp index e6c68e23d92..b322261ade9 100644 --- a/gdb/testsuite/gdb.threads/info-threads-options.exp +++ b/gdb/testsuite/gdb.threads/info-threads-options.exp @@ -27,7 +27,7 @@ save_vars { GDBFLAGS } { clean_restart $::testfile } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp b/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp index 44e4d6405e1..d3f328b0f55 100644 --- a/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp +++ b/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp @@ -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"] diff --git a/gdb/testsuite/gdb.threads/kill.exp b/gdb/testsuite/gdb.threads/kill.exp index 3e6aa8bdb75..72f829c416c 100644 --- a/gdb/testsuite/gdb.threads/kill.exp +++ b/gdb/testsuite/gdb.threads/kill.exp @@ -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} { diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp index 1fa83af5be2..635ffc83a80 100644 --- a/gdb/testsuite/gdb.threads/killed.exp +++ b/gdb/testsuite/gdb.threads/killed.exp @@ -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)] @@ -42,17 +42,17 @@ # 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 diff --git a/gdb/testsuite/gdb.threads/leader-exit.exp b/gdb/testsuite/gdb.threads/leader-exit.exp index 1bc017bad9f..85039b86b03 100644 --- a/gdb/testsuite/gdb.threads/leader-exit.exp +++ b/gdb/testsuite/gdb.threads/leader-exit.exp @@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp index 35cc255f1c7..c0ef9c7a567 100644 --- a/gdb/testsuite/gdb.threads/linux-dp.exp +++ b/gdb/testsuite/gdb.threads/linux-dp.exp @@ -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 } } diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp index 2cd296f3151..0a09897f22b 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -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" } diff --git a/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp b/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp index 1c3231cea26..c42c1a9659a 100644 --- a/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp +++ b/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/multiple-step-overs.exp b/gdb/testsuite/gdb.threads/multiple-step-overs.exp index 84eef1a8c34..c3456c25045 100644 --- a/gdb/testsuite/gdb.threads/multiple-step-overs.exp +++ b/gdb/testsuite/gdb.threads/multiple-step-overs.exp @@ -35,7 +35,7 @@ proc setup {} { with_test_prefix "setup" { clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/names.exp b/gdb/testsuite/gdb.threads/names.exp index 6f38c4e32b9..808fa2406eb 100644 --- a/gdb/testsuite/gdb.threads/names.exp +++ b/gdb/testsuite/gdb.threads/names.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp index 6b696ddf455..293b10011fc 100644 --- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp +++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp @@ -30,7 +30,7 @@ foreach schedlock {"off" "step" "on" } { with_test_prefix "schedlock=$schedlock" { clean_restart $::testfile - if ![runto_main] { + if {![runto_main]} { continue } diff --git a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp index edeabaf7986..96b5433ac67 100644 --- a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp +++ b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp @@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp index 846fe89ee95..7d2956d6904 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp @@ -31,7 +31,7 @@ proc do_test { lock_sched nonstop } { clean_restart ${executable} } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp index 860b6b52976..bb666446c68 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp @@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } { clean_restart ${executable} } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp index b50bfac824e..4490b30efc7 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp @@ -34,7 +34,7 @@ proc do_test { lock_sched nonstop } { clean_restart ${executable} } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp index 9892d83a29e..533e14f1e6a 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp @@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } { clean_restart ${executable} } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/non-ldr-exit.exp b/gdb/testsuite/gdb.threads/non-ldr-exit.exp index b09a37ed310..4dd1b79fb7c 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exit.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exit.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp index 5def610a85a..788a7e8c172 100644 --- a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp +++ b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/omp-par-scope.exp b/gdb/testsuite/gdb.threads/omp-par-scope.exp index 27dbaf0d5e9..2a097f5b738 100644 --- a/gdb/testsuite/gdb.threads/omp-par-scope.exp +++ b/gdb/testsuite/gdb.threads/omp-par-scope.exp @@ -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="] diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp index 3d2dc1493bd..a3fcba3436f 100644 --- a/gdb/testsuite/gdb.threads/print-threads.exp +++ b/gdb/testsuite/gdb.threads/print-threads.exp @@ -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 diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp index 6c6a4b1938d..63ddfecde3d 100644 --- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp +++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp index e914db054ed..e11b9043a2e 100644 --- a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp +++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp @@ -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. diff --git a/gdb/testsuite/gdb.threads/queue-signal.exp b/gdb/testsuite/gdb.threads/queue-signal.exp index 34abc3b8dd0..6ab8bbbf41c 100644 --- a/gdb/testsuite/gdb.threads/queue-signal.exp +++ b/gdb/testsuite/gdb.threads/queue-signal.exp @@ -22,7 +22,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ clean_restart ${::testfile} -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.threads/schedlock-new-thread.exp b/gdb/testsuite/gdb.threads/schedlock-new-thread.exp index 5fda4b8859a..0937e2a1bd1 100644 --- a/gdb/testsuite/gdb.threads/schedlock-new-thread.exp +++ b/gdb/testsuite/gdb.threads/schedlock-new-thread.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp index 4e2b835057f..125786823ea 100644 --- a/gdb/testsuite/gdb.threads/schedlock.exp +++ b/gdb/testsuite/gdb.threads/schedlock.exp @@ -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)" diff --git a/gdb/testsuite/gdb.threads/siginfo-threads.exp b/gdb/testsuite/gdb.threads/siginfo-threads.exp index ecc372d8408..253c4c03406 100644 --- a/gdb/testsuite/gdb.threads/siginfo-threads.exp +++ b/gdb/testsuite/gdb.threads/siginfo-threads.exp @@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \ clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp index e2f758106dd..b7a110d5799 100644 --- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp +++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp @@ -51,7 +51,7 @@ proc get_value {var test} { clean_restart $executable -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/sigstep-threads.exp b/gdb/testsuite/gdb.threads/sigstep-threads.exp index 0580cd0cb9d..9aed9e3303e 100644 --- a/gdb/testsuite/gdb.threads/sigstep-threads.exp +++ b/gdb/testsuite/gdb.threads/sigstep-threads.exp @@ -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 } } diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp index bbe11abf8f3..44cc6865ae0 100644 --- a/gdb/testsuite/gdb.threads/staticthreads.exp +++ b/gdb/testsuite/gdb.threads/staticthreads.exp @@ -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"] diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp index 309c8269b39..82861a93cf0 100644 --- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp +++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp @@ -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. diff --git a/gdb/testsuite/gdb.threads/step-over-exec.exp b/gdb/testsuite/gdb.threads/step-over-exec.exp index b06f3a479e3..22b9a1352e2 100644 --- a/gdb/testsuite/gdb.threads/step-over-exec.exp +++ b/gdb/testsuite/gdb.threads/step-over-exec.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp index 65aa2f14a60..3a96e0e3e9d 100644 --- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp index 9a028fead19..0e996569e23 100644 --- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.exp b/gdb/testsuite/gdb.threads/stepi-over-clone.exp index d6f1680900f..e0b14cbbd4c 100644 --- a/gdb/testsuite/gdb.threads/stepi-over-clone.exp +++ b/gdb/testsuite/gdb.threads/stepi-over-clone.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/stepi-random-signal.exp b/gdb/testsuite/gdb.threads/stepi-random-signal.exp index 8ac81e8b3c4..a2d7743f153 100644 --- a/gdb/testsuite/gdb.threads/stepi-random-signal.exp +++ b/gdb/testsuite/gdb.threads/stepi-random-signal.exp @@ -31,7 +31,7 @@ if { [gdb_compile_pthreads \ clean_restart $executable # Start the second thread. -if ![runto start] { +if {![runto start]} { return -1 } diff --git a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp index 80012299d99..19b50018088 100644 --- a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp +++ b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp @@ -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 } { diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp b/gdb/testsuite/gdb.threads/thread-execl.exp index 13a6ef4f378..d1c80df9189 100644 --- a/gdb/testsuite/gdb.threads/thread-execl.exp +++ b/gdb/testsuite/gdb.threads/thread-execl.exp @@ -41,7 +41,7 @@ proc do_test { schedlock } { gdb_test_no_output "set non-stop 1" } - if ![runto_main] { + if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.threads/thread_check.exp b/gdb/testsuite/gdb.threads/thread_check.exp index 9f92066bddd..6378e8a8cc8 100644 --- a/gdb/testsuite/gdb.threads/thread_check.exp +++ b/gdb/testsuite/gdb.threads/thread_check.exp @@ -15,16 +15,16 @@ # 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" \ diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp index 34de56194f6..de264b66276 100644 --- a/gdb/testsuite/gdb.threads/threadapply.exp +++ b/gdb/testsuite/gdb.threads/threadapply.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp index 8df857868aa..d57f437ff6a 100644 --- a/gdb/testsuite/gdb.threads/threadcrash.exp +++ b/gdb/testsuite/gdb.threads/threadcrash.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/threads-after-exec.exp b/gdb/testsuite/gdb.threads/threads-after-exec.exp index db26315855d..a6a3fb7bf5e 100644 --- a/gdb/testsuite/gdb.threads/threads-after-exec.exp +++ b/gdb/testsuite/gdb.threads/threads-after-exec.exp @@ -19,11 +19,11 @@ 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 } diff --git a/gdb/testsuite/gdb.threads/tid-reuse.exp b/gdb/testsuite/gdb.threads/tid-reuse.exp index 67621277ac0..ca5edc14268 100644 --- a/gdb/testsuite/gdb.threads/tid-reuse.exp +++ b/gdb/testsuite/gdb.threads/tid-reuse.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp index 6f3c711e8d3..fb684c9d16b 100644 --- a/gdb/testsuite/gdb.threads/tls-sepdebug.exp +++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp @@ -83,7 +83,7 @@ foreach library_path [list $absdir [relative_filename [pwd] $absdir]] \ gdb_load ${binmainfile} - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp index b7fa965f6ff..66dd52fe514 100644 --- a/gdb/testsuite/gdb.threads/tls-shared.exp +++ b/gdb/testsuite/gdb.threads/tls-shared.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/tls-var.exp b/gdb/testsuite/gdb.threads/tls-var.exp index de74bd97eb4..8d8b82ef5ab 100644 --- a/gdb/testsuite/gdb.threads/tls-var.exp +++ b/gdb/testsuite/gdb.threads/tls-var.exp @@ -27,7 +27,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != " clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp index 4b433871eb7..3dbc802d82d 100644 --- a/gdb/testsuite/gdb.threads/tls.exp +++ b/gdb/testsuite/gdb.threads/tls.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp index 8e9b1c33c9b..68fc99e21b7 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp +++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp @@ -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" diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp index 5d989132553..067986abb61 100644 --- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp +++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp @@ -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. diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp index f3ec7f4c1e8..e2d629def46 100644 --- a/gdb/testsuite/gdb.threads/watchthreads.exp +++ b/gdb/testsuite/gdb.threads/watchthreads.exp @@ -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 } diff --git a/gdb/testsuite/gdb.threads/watchthreads2.exp b/gdb/testsuite/gdb.threads/watchthreads2.exp index 19a60e47ddd..a31c1a74f0a 100644 --- a/gdb/testsuite/gdb.threads/watchthreads2.exp +++ b/gdb/testsuite/gdb.threads/watchthreads2.exp @@ -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 { diff --git a/gdb/testsuite/gdb.threads/wp-replication.exp b/gdb/testsuite/gdb.threads/wp-replication.exp index 8a5f95d6b51..1b63d572b65 100644 --- a/gdb/testsuite/gdb.threads/wp-replication.exp +++ b/gdb/testsuite/gdb.threads/wp-replication.exp @@ -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 } {