From: Tom de Vries Date: Tue, 30 Sep 2025 19:32:50 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.arch X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b5c1859bb1fa9dd1c6c1be6d2e952badcab50ec;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.arch Running tclint on the test-cases in gdb.arch shows a few problems. Fix these. --- diff --git a/gdb/tclint.toml b/gdb/tclint.toml index f32d0648829..f063e3d2078 100644 --- a/gdb/tclint.toml +++ b/gdb/tclint.toml @@ -34,7 +34,6 @@ exclude = [ "gdb/testsuite/boards", "gdb/testsuite/config", "gdb/testsuite/lib", -"gdb/testsuite/gdb.arch", "gdb/testsuite/gdb.base", # IGNORE (document reason in trailing comment): "gdb/testsuite/gdb.stabs", # To be removed. diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp index 091d1f8a4ca..fa80a9cb86b 100644 --- a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp +++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.exp b/gdb/testsuite/gdb.arch/aarch64-fp.exp index 0c24939c26c..ab4988cec5f 100644 --- a/gdb/testsuite/gdb.arch/aarch64-fp.exp +++ b/gdb/testsuite/gdb.arch/aarch64-fp.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp index 9c4b7d5570c..66990eba637 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto $linespec] { +if {![runto $linespec]} { return } @@ -40,14 +40,14 @@ proc check_core_file {core_filename saved_gcspr} { global decimal hex # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by .*\\." \ - "Program terminated with signal SIGSEGV, Segmentation fault" \ - "Guarded Control Stack error\\." \ - "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \ - "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ - "load core file"] { + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by .*\\." \ + "Program terminated with signal SIGSEGV, Segmentation fault" \ + "Guarded Control Stack error\\." \ + "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \ + "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ + "load core file"]} { return -1 } @@ -74,7 +74,7 @@ if {$core_generated} { } } -if ![gcore_cmd_available] { +if {![gcore_cmd_available]} { unsupported "target does not support gcore command." return } @@ -82,7 +82,7 @@ if ![gcore_cmd_available] { clean_restart gdb_load $binfile -if ![runto $linespec] { +if {![runto $linespec]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp index 2359d96aeeb..e6252511c5c 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp index 6f695da50fb..7e531e8a060 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp @@ -31,7 +31,7 @@ set begin_line [gdb_get_line_number "Break begin"] set call1_line [gdb_get_line_number "Break call1"] set call2_line [gdb_get_line_number "Break call2"] -if ![runto ${begin_line}] { +if {![runto ${begin_line}]} { return } @@ -39,7 +39,7 @@ proc restart_and_run_infcall_call2 {} { global binfile call2_line clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } set inside_infcall_str "The program being debugged stopped while in a function called from GDB" @@ -82,7 +82,7 @@ with_test_prefix "test return 'above' an inferior call" { clean_restart gdb_load $binfile -if ![runto ${begin_line}] { +if {![runto ${begin_line}]} { return } @@ -114,7 +114,7 @@ with_test_prefix "test return from current frame" { clean_restart gdb_load $binfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp index f0508cdc247..ba7741f9b4d 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp @@ -36,7 +36,7 @@ if {[gdb_protocol_is_remote]} { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs.exp b/gdb/testsuite/gdb.arch/aarch64-gcs.exp index b09e010459a..63c18a1e89d 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } @@ -80,7 +80,7 @@ gdb_test "print \$gcspr == \$gcspr_in_main - 16" ". = 1" \ # Test writing to GCSPR. clean_restart gdb_load $binfile -if ![runto normal_function0] { +if {![runto normal_function0]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp index 4cdd985ec0c..3891fcc7cc8 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp @@ -71,7 +71,7 @@ proc step_through_sequence { prefix } { return 0 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp index 70a49b50b53..20d2513b67c 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp @@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ } set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp index 7da836eba24..849780a20ec 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp @@ -67,14 +67,14 @@ proc test_mte_core_file { core_filename mode } { # has the expected value, that means the core file was generated correctly # and that GDB read the contents correctly. for {set i 0} {$i < $nmaps} {incr i} { - for {set offset 0} {$offset < $page_size} {set offset [expr $offset + 16]} { + for {set offset 0} {$offset < $page_size} {set offset [expr {$offset + 16}]} { set hex_tag [format "%x" $tag] gdb_test "memory-tag print-allocation-tag mmap_pointers\[$i\] + $offset" \ "= 0x$hex_tag" \ "mmap_ponters\[$i\] + $offset contains expected tag" # Update the expected tag. The test writes tags in sequential # order. - set tag [expr ($tag + 1) % 16] + set tag [expr {($tag + 1) % 16}] } } } @@ -98,7 +98,7 @@ proc test_mode { mode } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.exp b/gdb/testsuite/gdb.arch/aarch64-mte.exp index 8bb5814e21b..a2287557055 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mte.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mte.exp @@ -50,7 +50,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -63,7 +63,7 @@ if {![supports_memtag]} { gdb_breakpoint "access_memory" -if [gdb_continue "access_memory"] { +if {[gdb_continue "access_memory"]} { return -1 } @@ -104,7 +104,7 @@ with_test_prefix "literals" { set addr_tagged [get_tagged_ptr $i ${tagged_ptr_addr}] } - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-logical-tag ${addr_tagged}" \ " = 0x${tag_hexnz}" \ "print-logical-tag with tag ${i}" @@ -124,7 +124,7 @@ with_test_prefix "literals" { $atag_msg \ "set-allocation-tag with tag ${i}" - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-allocation-tag ${tagged_ptr_addr}" " = 0x${tag_hexnz}" \ "print-allocation-tag with tag ${i}" } @@ -139,7 +139,7 @@ with_test_prefix "literals" { $atag_msg \ "set-allocation-tag with tag ${i}" - set atag_hexnz [get_hex_tag [expr $i % 16]] + set atag_hexnz [get_hex_tag [expr {$i % 16}]] # Validate that the logical tag matches the allocation tag. with_test_prefix "tag ${i}" { @@ -152,14 +152,14 @@ with_test_prefix "literals" { # Get a pointer with the logical tag that does not match the # allocation tag. - set ltag [expr $i + 1] + set ltag [expr {$i + 1}] with_test_prefix "fetch mismatch tag ${i}" { set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}] } # Validate that the logical tag does not match the allocation # tag. - set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]] + set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]] gdb_test "memory-tag check ${addr_tagged}" \ "Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \ "check mismatch with tag ${i}" @@ -187,7 +187,7 @@ with_test_prefix "symbolic" { "update value of symbol ${tagged_ptr_symbol}" } - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-logical-tag ${tagged_ptr_symbol}" \ " = 0x${tag_hexnz}" \ "print-logical-tag with tag ${i}" @@ -211,7 +211,7 @@ with_test_prefix "symbolic" { $atag_msg \ "set-allocation-tag with tag ${i}" - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-allocation-tag ${tagged_ptr_symbol}" \ " = 0x${tag_hexnz}" \ "print-allocation-tag with tag ${i}" @@ -227,7 +227,7 @@ with_test_prefix "symbolic" { $atag_msg \ "set-allocation-tag with tag ${i}" - set atag_hexnz [get_hex_tag [expr $i % 16]] + set atag_hexnz [get_hex_tag [expr {$i % 16}]] # Validate that the logical tag matches the allocation tag. with_test_prefix "tag ${i}" { @@ -245,7 +245,7 @@ with_test_prefix "symbolic" { # Get a pointer with the logical tag that does not match the # allocation tag. - set ltag [expr $i + 1] + set ltag [expr {$i + 1}] with_test_prefix "fetch mismatch tag ${i}" { set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}] } @@ -257,7 +257,7 @@ with_test_prefix "symbolic" { # Validate that the logical tag does not match the allocation # tag. - set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]] + set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]] gdb_test "memory-tag check ${tagged_ptr_symbol}" \ "Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \ "check mismatch with tag ${i}" @@ -281,7 +281,7 @@ with_test_prefix "print command" { return -1 } - set atag [expr [expr $ltag + 1] % 16] + set atag [expr {($ltag + 1) % 16}] set atag_hexnn [get_tag_nn $atag] gdb_test "memory-tag set-allocation-tag ${tagged_ptr_symbol} 1 ${atag_hexnn}" \ @@ -334,13 +334,13 @@ gdb_test "continue" \ # Restart to execute the async tag fault test. with_test_prefix "async" { - if ![runto_main] { + if {![runto_main]} { return -1 } gdb_breakpoint "access_memory" - if [gdb_continue "access_memory"] { + if {[gdb_continue "access_memory"]} { fail "could not run to tagged memory test function" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp index 0f90da82edb..e3023d1a206 100644 --- a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp +++ b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.arch/aarch64-pauth.exp index 72cefa19f8e..89193ce3762 100644 --- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp +++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp @@ -45,7 +45,7 @@ if {!$compilation_ok} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-prologue.exp b/gdb/testsuite/gdb.arch/aarch64-prologue.exp index f782daac982..2e0d05de298 100644 --- a/gdb/testsuite/gdb.arch/aarch64-prologue.exp +++ b/gdb/testsuite/gdb.arch/aarch64-prologue.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp index f8039d43ed8..cce73764de4 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp @@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${compile_f return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -91,7 +91,7 @@ gdb_breakpoint [gdb_get_line_number "exit(0)"] gdb_continue_to_breakpoint "exit" ".*exit.*" set handlerframe [get_current_frame_number] -set mainframe [expr $handlerframe + 2] +set mainframe [expr {$handlerframe + 2}] # Check register values diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl index 64cfd54c868..b57ff735551 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl @@ -25,13 +25,13 @@ load_lib aarch64-scalable.exp # proc check_sme_core_file { core_filename state vl svl } { # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by.*\." \ - "Program terminated with signal SIGSEGV, Segmentation fault\." \ - "#0 ${::hex} in main \\(.*\\) at .*" \ + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by.*\." \ + "Program terminated with signal SIGSEGV, Segmentation fault\." \ + "#0 ${::hex} in main \\(.*\\) at .*" \ ".*p = 0xff;.* crash point .*"] \ - "load core file"] { + "load core file"]} { untested "failed to generate core file" return -1 } @@ -169,7 +169,7 @@ proc test_sme_core_file { id_start id_end } { return -1 } - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl index 4dc106e4ece..de17e4e95ca 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl @@ -34,11 +34,11 @@ require !gdb_protocol_is_remote # proc check_regs { mode vl svl } { # Check VG to make sure it is correct - set expected_vg [expr $vl / 8] + set expected_vg [expr {$vl / 8}] gdb_test "print \$vg" "= ${expected_vg}" # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # If svl is adjusted by prctl, we will have ZA enabled. If gdb is @@ -50,13 +50,13 @@ proc check_regs { mode vl svl } { } # Check SVCR. - if [gdb_test "print \$svcr" $za_state "svcr before assignments" ] { + if {[gdb_test "print \$svcr" $za_state "svcr before assignments" ]} { fail "incorrect za state" return -1 } # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the size of Z0. @@ -69,7 +69,7 @@ proc check_regs { mode vl svl } { # Exercise reading/writing from/to the tile pseudo-registers. set last_tile 1 - set expected_size [expr $svl * $svl] + set expected_size [expr {$svl * $svl}] set tile_svl $svl set za_state "= \\\[ ZA \\\]" foreach_with_prefix granularity {"b" "h" "s" "d" "q"} { @@ -83,7 +83,7 @@ proc check_regs { mode vl svl } { initialize_2d_array $register_name 255 $tile_svl $tile_svl # Make sure we have ZA state. - if [gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ] { + if {[gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ]} { fail "incorrect za state" return -1 } @@ -91,9 +91,9 @@ proc check_regs { mode vl svl } { set pattern [string_to_regexp [2d_array_value_pattern 255 $tile_svl $tile_svl]] gdb_test "print $register_name" " = $pattern" "read back from $register_name" } - set last_tile [expr $last_tile * 2] - set expected_size [expr $expected_size / 2] - set tile_svl [expr $tile_svl / 2] + set last_tile [expr {$last_tile * 2}] + set expected_size [expr {$expected_size / 2}] + set tile_svl [expr {$tile_svl / 2}] } # Exercise reading/writing from/to the tile slice pseudo-registers. @@ -114,7 +114,7 @@ proc check_regs { mode vl svl } { initialize_1d_array $register_name 255 $num_elements # Make sure we have ZA state. - if [gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ] { + if {[gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ]} { fail "incorrect za state" return -1 } @@ -124,13 +124,13 @@ proc check_regs { mode vl svl } { } } } - set last_tile [expr $last_tile * 2] - set last_slice [expr ($last_slice / 2)] - set num_elements [expr $num_elements / 2] + set last_tile [expr {$last_tile * 2}] + set last_slice [expr {($last_slice / 2)}] + set num_elements [expr {$num_elements / 2}] } # Exercise reading/writing from/to SME2 registers. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" @@ -163,7 +163,7 @@ proc test_sme_registers_available { id_start id_end } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -245,8 +245,8 @@ proc test_sme_registers_available { id_start id_end } { gdb_continue_to_breakpoint $non_prctl_breakpoint # Adjust svl via gdb. - set vg_value [expr $vl / 8] - set svg_value [expr $svl / 8] + set vg_value [expr {$vl / 8}] + set svg_value [expr {$svl / 8}] gdb_test_no_output "set \$vg = ${vg_value}" gdb_test_no_output "set \$svg = ${svg_value}" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl index 403da75a4d0..4f37019168e 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl @@ -42,7 +42,7 @@ proc test_sme_registers_sigframe { id_start id_end } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -83,16 +83,16 @@ proc test_sme_registers_sigframe { id_start id_end } { } # Run the program until it has adjusted the svl. - if [gdb_continue_to_breakpoint $sigill_breakpoint] { + if {[gdb_continue_to_breakpoint $sigill_breakpoint]} { return -1 } # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the value of SVCR. @@ -134,14 +134,14 @@ proc test_sme_registers_sigframe { id_start id_end } { gdb_test_no_output "set \$tpidr2=0x0102030405060708" # Run to the illegal instruction. - if [gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"] { + if {[gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"]} { return } # Skip the illegal instruction. The signal handler will be called after we continue. gdb_test_no_output "set \$pc=\$pc+4" # Continue to the signal handler. - if [gdb_continue_to_breakpoint $handler_breakpoint] { + if {[gdb_continue_to_breakpoint $handler_breakpoint]} { return -1 } @@ -159,7 +159,7 @@ proc test_sme_registers_sigframe { id_start id_end } { } # Check the size of ZA in the signal frame. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" "size of za in signal frame" # Check the value of SVCR in the signal frame. @@ -172,7 +172,7 @@ proc test_sme_registers_sigframe { id_start id_end } { gdb_test "print/x \$tpidr2" " = 0x102030405060708" "tpidr2 contents from signal frame" # Check the value of SME2 ZT0 in the signal frame. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl index ba69b767878..04e8b889b7c 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl @@ -26,21 +26,21 @@ load_lib aarch64-scalable.exp # proc_with_prefix check_regs { vl svl } { # Check VG to make sure it is correct - set expected_vg [expr $vl / 8] + set expected_vg [expr {$vl / 8}] gdb_test "print \$vg" "= ${expected_vg}" # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # Make sure there is no SM or ZA state. - if [gdb_test "print \$svcr" "= \\\[ \\\]"] { + if {[gdb_test "print \$svcr" "= \\\[ \\\]"]} { fail "incorrect ZA state" return -1 } # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the size of Z0. @@ -69,15 +69,15 @@ proc_with_prefix check_regs { vl svl } { } } } - set last_tile [expr $last_tile * 2] - set last_slice [expr ($last_slice / 2)] - set elements [expr ($elements / 2)] + set last_tile [expr {$last_tile * 2}] + set last_slice [expr {($last_slice / 2)}] + set elements [expr {($elements / 2)}] } # Exercise reading/writing the tile pseudo-registers. set last_tile 1 set elements $svl - set expected_size [expr $svl * $svl] + set expected_size [expr {$svl * $svl}] foreach_with_prefix granularity {"b" "h" "s" "d" "q"} { set pattern [string_to_regexp [2d_array_value_pattern 0 $elements $elements]] for {set tile 0} {$tile < $last_tile} {incr tile} { @@ -86,13 +86,13 @@ proc_with_prefix check_regs { vl svl } { gdb_test "print sizeof ${register_name}" " = ${expected_size}" gdb_test "print ${register_name}" $pattern } - set last_tile [expr $last_tile * 2] - set expected_size [expr $expected_size / 2] - set elements [expr ($elements / 2)] + set last_tile [expr {$last_tile * 2}] + set expected_size [expr {$expected_size / 2}] + set elements [expr {($elements / 2)}] } # Exercise reading from SME2 registers. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" @@ -128,7 +128,7 @@ proc test_sme_registers_unavailable { id_start id_end } { return -1 } - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -207,8 +207,8 @@ proc test_sme_registers_unavailable { id_start id_end } { } # Adjust vg and svg. - set vg_value [expr $vl / 8] - set svg_value [expr $svl / 8] + set vg_value [expr {$vl / 8}] + set svg_value [expr {$svl / 8}] gdb_test_no_output "set \$vg = ${vg_value}" gdb_test_no_output "set \$svg = ${svg_value}" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp index c72e5784fd4..96640698d79 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp @@ -60,8 +60,8 @@ gdb_test_no_output "set print repeats 1" "adjust repeat count" # Fetch both the vector length and the streaming vector length the target # system is using. We do not force any vector lengths and do not change # it mid-execution. -set vl [expr [get_valueof "" "\$vg" "0" "fetch value of vl"] * 8] -set svl [expr [get_valueof "" "\$svg" "0" "fetch value of svl"] * 8] +set vl [expr {[get_valueof "" "\$vg" "0" "fetch value of vl"] * 8}] +set svl [expr {[get_valueof "" "\$svg" "0" "fetch value of svl"] * 8}] # Now we are at the point where we can start checking state and moving the # testcase forward. diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp index 32340bb53a3..7a47fc78dfb 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp @@ -58,12 +58,12 @@ gdb_test "handle SIGUSR1 nostop" \ set linespec ${srcfile}:[gdb_get_line_number "Break here."] gdb_test_no_output "set args $first_vl $second_vl" -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } -set first_vg [expr $first_vl/8] -set second_vg [expr $second_vl/8] +set first_vg [expr {$first_vl/8}] +set second_vg [expr {$second_vl/8}] gdb_test "print \$vg" ". = $second_vg" "vg was changed" @@ -77,10 +77,10 @@ for {set row 0} {$row < 32} {incr row} { for {set row 0} {$row < 16} {incr row} { set register_name "\$p${row}" - gdb_test "print $register_name" ". = \\{(0, ){[expr $second_vl/8 - 1]}0\\}" \ + gdb_test "print $register_name" ". = \\{(0, ){[expr {$second_vl/8 - 1}]}0\\}" \ "$register_name contents in signal handler" } -gdb_test "print \$ffr" ". = \\{(255, ){[expr $second_vl/8 - 1]}255\\}" \ +gdb_test "print \$ffr" ". = \\{(255, ){[expr {$second_vl/8 - 1}]}255\\}" \ "ffr contents in signal handler" gdb_test "frame function main" \ @@ -99,8 +99,8 @@ for {set row 0} {$row < 32} {incr row} { for {set row 0} {$row < 16} {incr row} { set register_name "\$p${row}" - gdb_test "print $register_name" ". = \\{(1, ){[expr $first_vl/8 - 1]}1\\}" \ + gdb_test "print $register_name" ". = \\{(1, ){[expr {$first_vl/8 - 1}]}1\\}" \ "$register_name contents were correctly unwound" } -gdb_test "print \$ffr" ". = \\{(255, ){[expr $first_vl/8 - 1]}255\\}" \ +gdb_test "print \$ffr" ". = \\{(255, ){[expr {$first_vl/8 - 1}]}255\\}" \ "ffr contents were correctly unwound" diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.exp b/gdb/testsuite/gdb.arch/aarch64-sve.exp index 34bcff26780..6cdc30d6458 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sve.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sve.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { set linespec ${srcfile}:[gdb_get_line_number "break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } @@ -59,7 +59,7 @@ proc get_register_value {register} { # The test executable halves the vector length in a loop, so loop along # to check it. -for {set i [get_register_value "vg"]} {$i > 1} {set i [expr $i / 2]} { +for {set i [get_register_value "vg"]} {$i > 1} {set i [expr {$i / 2}]} { set lines_before [count_info_registers] gdb_test "next" ".*if .res < 0." "step over prctl vg = ${i}" diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp index 904f92fe879..eb2bc926786 100644 --- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp +++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp index 1bcd1b20b64..bc6d242329f 100644 --- a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp index 409beec80fd..06c66269465 100644 --- a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp +++ b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp index bdbfeecd341..aea492e5206 100644 --- a/gdb/testsuite/gdb.arch/alpha-step.exp +++ b/gdb/testsuite/gdb.arch/alpha-step.exp @@ -42,50 +42,50 @@ proc test_stepi {function } { gdb_test "break *$function+4" \ "Breakpoint .* at .*" \ "breakpoint on fb$function instruction" - + gdb_test "continue" \ "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ "continue to fb$function instruction (first call)" - + # Extra check to make sure we stopped on the FP branch instruction. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ "Check breakpoint on fb$function instruction (first call)" - + # Step test, followed by the check that we landed on the expected # instruction (the testcase should be written in such a way that # the branch is taken on the first call to this function. - + gdb_test "stepi" \ "0x\[0-9a-fA-F\]+.*" \ "stepi on fb$function (first call)" - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \ "Check stepi over fb$function stopped on ret" - + # Continue again. FUNCTION should be called a second time, this time # with an argument such that the FP branch will not be taken. - + gdb_test "continue" \ "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ "continue to fb$function instruction (second call)" - + # Extra check to make sure we stopped on the FP branch instruction. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ "Check breakpoint on fb$function instruction (second call)" - + # Step test, branch should not be taken. - + gdb_test "stepi" \ "0x\[0-9a-fA-F\]+.*" \ "stepi on fb$function (branch not taken)" - + # Extra check to verify that we landed on the instruction we expected. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \ "check stepi over fb$function stopped on fneg instruction" diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp index fb5367d6b14..c41e82d3e4e 100644 --- a/gdb/testsuite/gdb.arch/altivec-abi.exp +++ b/gdb/testsuite/gdb.arch/altivec-abi.exp @@ -39,7 +39,7 @@ proc altivec_abi_tests { extra_flags force_abi } { if { "$force_abi" == "auto" } { # If the toolchain does not record attributes, skip auto-ABI tests. set readelf_program [gdb_find_readelf] - set result [catch "exec $readelf_program -A $binfile" output] + set result [catch {exec $readelf_program -A $binfile} output] if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} { untested "ABI not marked" @@ -132,7 +132,7 @@ proc altivec_abi_tests { extra_flags force_abi } { gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector" } -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set binprefix ${binfile} with_test_prefix "default ABI, auto" { @@ -166,7 +166,7 @@ if [test_compiler_info gcc*] { altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto" } } -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { altivec_abi_tests "additional_flags=-qaltivec" "auto" } else { warning "unknown compiler" diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp index d297f4bb37f..dfe7e243a96 100644 --- a/gdb/testsuite/gdb.arch/altivec-regs.exp +++ b/gdb/testsuite/gdb.arch/altivec-regs.exp @@ -1,5 +1,5 @@ # Copyright (C) 2002-2025 Free Software Foundation, Inc. -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -26,9 +26,9 @@ require allow_altivec_tests standard_testfile set compile_flags {debug nowarnings} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler" @@ -134,11 +134,11 @@ gdb_test "continue" \ "Breakpoint $decimal, vector_fun .a=.0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe., b=.0x1010101, 0x1010101, 0x1010101, 0x1010101.*altivec-regs.c.*vec_splat_u8.2..;" \ "continue to vector_fun" -# Do a next over the assignment to vector 'a'. +# Do a next over the assignment to vector 'a'. gdb_test "next" ".*b = \\(\\(vector unsigned int\\) vec_splat_u8\\(3\\)\\);" \ "next (1)" -# Do a next over the assignment to vector 'b'. +# Do a next over the assignment to vector 'b'. gdb_test "next" "c = vec_add \\(a, b\\);" \ "next (2)" diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp index 7f0a8b8f133..a2caf465a54 100644 --- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp +++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp index d0843031efa..d67361d7ccf 100644 --- a/gdb/testsuite/gdb.arch/amd64-byte.exp +++ b/gdb/testsuite/gdb.arch/amd64-byte.exp @@ -63,7 +63,7 @@ with_test_prefix "at first bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "print/x \$$byte_regs($h)" \ ".. = 0x[format %x $r]2" \ "check contents of %$byte_regs($h)" @@ -85,7 +85,7 @@ with_test_prefix "at second bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" } } @@ -101,7 +101,7 @@ with_test_prefix "at third bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "print \$$byte_regs($h)" \ ".. = $h" \ "check contents of %$byte_regs($h)" diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp index 61ce4bebe2d..cd982a0c7a1 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp @@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" { } # Clear the slot on the stack and confirm it was set to zero. -set sp [expr $sp - 0x8] +set sp [expr {$sp - 0x8}] gdb_test_no_output "set {unsigned long long} $sp = 0" \ "clear stack slot" set zero_val 0x[format %016x 0] @@ -73,7 +73,7 @@ gdb_test "stepi" \ # Check stack pointer was updated to the expected value. set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \ "get stack pointer after step"] -gdb_assert {[expr $sp == $new_sp]} \ +gdb_assert {[expr {$sp == $new_sp}]} \ "check stack pointer was updated as expected" # Check the contents of the stack were updated to the expected value. diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp index aee1d7a5d2a..3b0d82886d7 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp +++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp @@ -143,7 +143,7 @@ proc set_regs { regs val } { # Use send_gdb/gdb_expect so that these aren't logged as pass/fail. send_gdb "set \$${reg} = ${val}\n" gdb_expect 10 { - -re "$gdb_prompt $" { + -re "$gdb_prompt $" { verbose "Setting ${reg} to ${val}." 2 } timeout { @@ -223,7 +223,7 @@ proc rip_test { reg test_start_label test_end_label signal_modes } { # the displaced step, but instead just delivers the signal. set inferior_pid [get_inferior_pid] # Ensure that $inferior_pid refers to a single process. - gdb_assert {[expr $inferior_pid > 0]} \ + gdb_assert {[expr {$inferior_pid > 0}]} \ "check for a sane inferior pid" if {$inferior_pid > 0} { remote_exec target "kill -ALRM $inferior_pid" diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp index 14946d702ff..ec6ebc4acd4 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S .c -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp index d31c057e3b5..2207ecfbd18 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1" standard_testfile .c .c lappend opts optimize=-O2 dwarf5 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp index 0c7cd213bf7..57b3ca452e8 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp index e508a041a0b..94737f30836 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp @@ -18,7 +18,7 @@ standard_testfile .S .cc require is_x86_64_m64_target # Make .cc available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -27,7 +27,7 @@ if { [prepare_for_testing_full "failed to prepare" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index 2bc676c4647..59f09752b8a 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -16,7 +16,7 @@ standard_testfile .s set opts {nopie} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1" set srcfile ${testfile}.cc lappend opts debug @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-eval.exp b/gdb/testsuite/gdb.arch/amd64-eval.exp index 3d798eeacfa..79ff8aa86ea 100644 --- a/gdb/testsuite/gdb.arch/amd64-eval.exp +++ b/gdb/testsuite/gdb.arch/amd64-eval.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp index 356afc7e668..dcdb850a6b3 100644 --- a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp +++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp @@ -37,7 +37,7 @@ proc test_run {} { set main_r12 [get_integer_valueof "\$r12" "null"] gdb_assert { $main_r12 ne "null" } - set foo_r12 [expr "$main_r12 + 2"] + set foo_r12 [expr {$main_r12 + 2}] gdb_test "print \$r12=$foo_r12" "$foo_r12" "Set foo's %r12=$foo_r12" gdb_test "up" ".*main.*" "Go up a frame from foo" gdb_test "print \$r12" "$main_r12" "foo's %r12 unwound" @@ -52,7 +52,7 @@ proc offset_test_run {} { set old_reg_val [get_integer_valueof "\$r12" "null"] gdb_assert { $old_reg_val ne "null" } - set new_reg_val [expr "$old_reg_val + 3"] + set new_reg_val [expr {$old_reg_val + 3}] gdb_test "print \$r14=$new_reg_val" "$new_reg_val" "Set %r14=$new_reg_val" gdb_test "print \$r13=$new_reg_val" "$new_reg_val" "Set %r13=$new_reg_val" gdb_test "print \$r12=$new_reg_val" "$new_reg_val" "Set %r12=$new_reg_val" diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp index 90cbe02151c..a48cbec62d3 100644 --- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp +++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp index 55a25dbbbdd..31ce7046b69 100644 --- a/gdb/testsuite/gdb.arch/amd64-i386-address.exp +++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp @@ -21,7 +21,7 @@ require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target require {!istarget "*-*-openbsd*"} -if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] { +if {[prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp index 451c84b8475..a499eae7a3e 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp @@ -35,7 +35,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] } return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -47,7 +47,7 @@ gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -61,7 +61,7 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp index b715ecf410a..7f1b8060936 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp @@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -51,7 +51,7 @@ gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -65,7 +65,7 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp index 1b85e4e950b..38ce3ace203 100644 --- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp +++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-optimout-repeat.exp COMPILE=1" set srcfile ${srcfile2} lappend opts debug optimize=-O2 @@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp index 844797393c9..3a688ab6bfe 100644 --- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp +++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp @@ -20,7 +20,7 @@ set csrcfile [file rootname $srcfile].c set csrcfile ${testfile}.c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1' set srcfile ${csrcfile} lappend opts debug optimize=-O0 @@ -32,7 +32,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp index 039f528ad27..82d68da6764 100644 --- a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp +++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp @@ -26,13 +26,13 @@ proc check_core_file {core_filename saved_pl3_ssp} { global decimal # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by .*\\." \ - "Program terminated with signal SIGSEGV, Segmentation fault.*" \ - "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \ - "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ - "load core file"] { + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by .*\\." \ + "Program terminated with signal SIGSEGV, Segmentation fault.*" \ + "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \ + "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ + "load core file"]} { return } @@ -52,7 +52,7 @@ save_vars { ::env(GLIBC_TUNABLES) } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] - if ![runto $linespec] { + if {![runto $linespec]} { return } @@ -78,14 +78,14 @@ save_vars { ::env(GLIBC_TUNABLES) } { } } - if ![gcore_cmd_available] { + if {![gcore_cmd_available]} { unsupported "target does not support gcore command." return } clean_restart $::testfile - if ![runto $linespec] { + if {![runto $linespec]} { return } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp index 7e1df433246..5fbdf8b9188 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile amd64-tailcall-cxx1.S amd64-tailcall-cxx2.S -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-cxx.exp COMPILE=1" standard_testfile amd64-tailcall-cxx1.cc amd64-tailcall-cxx2.cc lappend opts debug @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} "${srcfile} ${srcfile2 return -1 } -if ![runto g] { +if {![runto g]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp index fe65c4d117c..12abf58140e 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-noret.exp COMPILE=1" standard_testfile lappend opts debug optimize=-O2 @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto noret] { +if {![runto noret]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp index 51baf7b6dc6..e96b85b2354 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S .c -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp index de3c606a4db..e5f47eb71ee 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } { return -1 } -if ![runto b] { +if {![runto b]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp index 1b084f977ba..dc1149cc3df 100644 --- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp +++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp @@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -85,7 +85,7 @@ proc prologue_test {funcname {savedregs ""} {fp_offset ""} } { } if { $fp_offset != "" } { set sp [get_integer_valueof \$sp -1 "get value of sp in $funcname"] - set fp_val [expr $sp + $fp_offset] + set fp_val [expr {$sp + $fp_offset}] set fp_real_val \ [get_integer_valueof \$fp 0 "get value of fp in $funcname"] if { $fp_real_val != $fp_val } { diff --git a/gdb/testsuite/gdb.arch/arc-dbnz.exp b/gdb/testsuite/gdb.arch/arc-dbnz.exp index 056321097e8..7f76aa2ea50 100644 --- a/gdb/testsuite/gdb.arch/arc-dbnz.exp +++ b/gdb/testsuite/gdb.arch/arc-dbnz.exp @@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.exp b/gdb/testsuite/gdb.arch/arc-decode-insn.exp index 5e7f3c2590a..01b23ebec12 100644 --- a/gdb/testsuite/gdb.arch/arc-decode-insn.exp +++ b/gdb/testsuite/gdb.arch/arc-decode-insn.exp @@ -39,7 +39,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -53,7 +53,7 @@ proc test_branch_insn { test_name } { # Calculate instruction length, based on ${test_name}_end symbol. set end_pc [get_hexadecimal_valueof &${test_name}_end -1] - set length [expr $end_pc - $pc] + set length [expr {$end_pc - $pc}] set target_address [get_hexadecimal_valueof &${test_name}_target -1] diff --git a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp index f3aca94dc5a..d01f8178618 100644 --- a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp +++ b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile ]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/arm-neon.exp b/gdb/testsuite/gdb.arch/arm-neon.exp index b38a6858d69..b29b9ca23e7 100644 --- a/gdb/testsuite/gdb.arch/arm-neon.exp +++ b/gdb/testsuite/gdb.arch/arm-neon.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug quie return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp index cafae606c81..ea585432385 100644 --- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp +++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp @@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } -if ![runto [gdb_get_line_number "break here."]] { +if {![runto [gdb_get_line_number "break here."]]} { untested "could not run to \"break here.\"" return -1 } diff --git a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp index a7cd5f362fa..6a08f70bac5 100644 --- a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp +++ b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp @@ -21,12 +21,12 @@ require support_displaced_stepping # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp index b1eb8654cf8..b468e71fadf 100644 --- a/gdb/testsuite/gdb.arch/e500-prologue.exp +++ b/gdb/testsuite/gdb.arch/e500-prologue.exp @@ -37,7 +37,7 @@ proc insert_breakpoint {function expected_location} { global gdb_prompt global expect_out global hex - + set address "" # Insert a breakpoint using the given function name, and extract diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp index 6d69cccc9c7..fa10b4f6a1d 100644 --- a/gdb/testsuite/gdb.arch/e500-regs.exp +++ b/gdb/testsuite/gdb.arch/e500-regs.exp @@ -1,5 +1,5 @@ # Copyright 2003-2025 Free Software Foundation, Inc. -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -155,11 +155,11 @@ gdb_test "continue" \ "Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \ "continue to vector_fun" -# Do a next over the assignment to vector 'a'. +# Do a next over the assignment to vector 'a'. gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \ "next (1)" -# Do a next over the assignment to vector 'b'. +# Do a next over the assignment to vector 'b'. gdb_test "next" "c = __ev_and \\(a, b\\);" \ "next (2)" diff --git a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp index 80df6b99ca6..d8b94f2db37 100644 --- a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp +++ b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp @@ -19,16 +19,16 @@ standard_testfile insn-reloc.c # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -if [prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -48,7 +48,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ clean_restart $testfile set remote_libipa [gdb_load_shlib $libipa] -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp index ba41a8c2071..3a1d8e8607b 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.exp +++ b/gdb/testsuite/gdb.arch/i386-avx.exp @@ -53,7 +53,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ "set first breakpoint in main" gdb_continue_to_breakpoint "continue to first breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 16 } else { set nr_regs 8 @@ -79,7 +79,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ "check contents of data\[$r\]" } diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp index dcd6cc9a522..675a3c79801 100644 --- a/gdb/testsuite/gdb.arch/i386-avx512.exp +++ b/gdb/testsuite/gdb.arch/i386-avx512.exp @@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -78,7 +78,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" set nr_regs 7 for { set r 0 } { $r < $nr_regs } { incr r } { - set val [expr $r + 1] + set val [expr {$r + 1}] gdb_test "print/x k_data\[$r\]" \ ".. = 0x$val$val$val$val" \ "check contents of k_data\[$r\]" @@ -89,7 +89,7 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ "set third breakpoint in main" gdb_continue_to_breakpoint "continue to third breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 32 } else { set nr_regs 8 @@ -134,7 +134,7 @@ gdb_continue_to_breakpoint "continue to fourth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], [expr $r.125 + 10], [expr $r.25 + 10], [expr $r.375 + 10], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], [expr {$r + 10.125}], [expr {$r + 10.25}], [expr {$r + 10.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r +10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing ZMM regs" } @@ -152,7 +152,7 @@ gdb_continue_to_breakpoint "continue to fifth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 20], [expr $r.125 + 20], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 20}], [expr {$r + 20.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing YMM regs" } @@ -168,7 +168,7 @@ gdb_continue_to_breakpoint "continue to sixth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 30], [expr $r.125 + 30], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 30}], [expr {$r + 30.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing XMM regs" } diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp index 6e839391709..c04b87db58a 100644 --- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp +++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp @@ -54,7 +54,7 @@ set corefile [gdb_remote_download host $corefile] # First check if this particular GDB supports i386, otherwise we should not # expect the i386 core file to be loaded successfully. set archs [get_set_option_choices "set architecture" "i386"] -set supports_arch_i386 [expr [lsearch -exact $archs i386] != -1] +set supports_arch_i386 [expr {[lsearch -exact $archs i386] != -1}] # Wrongly built GDB complains by: # "..." is not a core dump: File format not recognized diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp index 1eff9774ae4..12b57f38754 100644 --- a/gdb/testsuite/gdb.arch/i386-byte.exp +++ b/gdb/testsuite/gdb.arch/i386-byte.exp @@ -51,7 +51,7 @@ with_test_prefix "at first bp" { gdb_test "print/x \$$byte_regs($r)" \ ".. = 0x[format %x $r]1" \ "check contents of %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "print/x \$$byte_regs($h)" \ ".. = 0x[format %x $r]2" \ "check contents of %$byte_regs($h)" @@ -59,7 +59,7 @@ with_test_prefix "at first bp" { for { set r 1 } { $r <= 4 } { incr r } { gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" } } @@ -72,7 +72,7 @@ with_test_prefix "at second bp" { gdb_test "print \$$byte_regs($r)" \ ".. = $r" \ "check contents of %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "print \$$byte_regs($h)" \ ".. = $h" \ "check contents of %$byte_regs($h)" diff --git a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp index 7291f02b796..661265b2815 100644 --- a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp +++ b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp @@ -21,11 +21,11 @@ require is_x86_like_target set testfile "i386-cfi-notcurrent" set srcfile ${testfile}.S -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}]} { return -1 } -if ![runto f] { +if {![runto f]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp index 3e8ae1cbfce..1d4c87ec272 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp @@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" { } # Clear the slot on the stack and confirm it was set to zero. -set sp [expr $sp - 0x4] +set sp [expr {$sp - 0x4}] gdb_test_no_output "set {unsigned int} $sp = 0" \ "clear stack slot" set zero_val 0x[format %08x 0] @@ -73,7 +73,7 @@ gdb_test "stepi" \ # Check stack pointer was updated to the expected value. set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \ "get stack pointer after step"] -gdb_assert {[expr $sp == $new_sp]} \ +gdb_assert {[expr {$sp == $new_sp}]} \ "check stack pointer was updated as expected" # Check the contents of the stack were updated to the expected value. diff --git a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp index 11b477378d4..16d28720c45 100644 --- a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp +++ b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp @@ -23,7 +23,7 @@ require {is_any_target "i?86-*-*" "x86_64-*-*"} standard_testfile -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp index 7262b8bd248..6355c43e528 100644 --- a/gdb/testsuite/gdb.arch/i386-pkru.exp +++ b/gdb/testsuite/gdb.arch/i386-pkru.exp @@ -34,7 +34,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -63,8 +63,8 @@ set v [linux_kernel_version] if { $v != {} } { set have_xfail \ [expr \ - [version_compare [list 5 14 0] <= $v] \ - && [version_compare $v < [list 6 2 0]]] + {[version_compare [list 5 14 0] <= $v] \ + && [version_compare $v < [list 6 2 0]]}] } # Test pkru register at startup diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp index b289b848277..ac2be79c981 100644 --- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp +++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp @@ -38,7 +38,7 @@ proc test_run {} { set bp_addr $expect_out(1,string) # Convert to decimal. - set bp_addr [expr $bp_addr] + set bp_addr [expr {$bp_addr}] pass $gdb_test_name } diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp index af0b56dc1b3..6b9260b7180 100644 --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp @@ -22,7 +22,7 @@ set executable ${testfile} set binfile [standard_output_file ${executable}] set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { set srcfile ${csrcfile} lappend opts debug optimize=-O2 additional_flags=-msse } @@ -53,5 +53,5 @@ foreach i {0 1 2 3 4} { if {$args != ""} { set args "$args, " } - set args "$args[expr $i + 1]" + set args "$args[expr {$i + 1}]" } diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp index 154f5ea53cd..ee22b62de61 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.exp +++ b/gdb/testsuite/gdb.arch/i386-sse.exp @@ -68,7 +68,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ "set first breakpoint in main" gdb_continue_to_breakpoint "continue to first breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 16 } else { set nr_regs 8 @@ -94,6 +94,6 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], $r.25, $r.5, $r.75\\}\\}.*" \ "check contents of data\[$r\]" } diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp index d6fd14cfbdd..ed617fc1384 100644 --- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp +++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp @@ -27,7 +27,7 @@ clean_restart gdb_load $binfile # We need to start the inferior to place the breakpoints in the memory at all. -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -54,7 +54,7 @@ gdb_test_multiple "b bundle" $test { } } -if ![info exists bpt2address] { +if {![info exists bpt2address]} { return -1 } @@ -65,7 +65,7 @@ set test "disassembly with breakpoints" gdb_test_multiple "disass main" $test { -re $match { set got $expect_out(1,string) - if [string equal -nocase $orig $got] { + if {[string equal -nocase $orig $got]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/mips-fcr.exp b/gdb/testsuite/gdb.arch/mips-fcr.exp index b47c37171bd..6fe332a6c85 100644 --- a/gdb/testsuite/gdb.arch/mips-fcr.exp +++ b/gdb/testsuite/gdb.arch/mips-fcr.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp index f43127d3c8d..1921578b29f 100644 --- a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp +++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp @@ -4,16 +4,16 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, see . -# Test single-step on bbit. +# Test single-step on bbit. require {istarget "*octeon*"} @@ -48,7 +48,7 @@ proc single_step_until { match } { set insn [current_insn] set start [timestamp] while { $insn != "" && [timestamp] - $start < 3*$timeout } { - if [regexp $match $insn] { + if {[regexp $match $insn]} { return 1 } if {![single_step]} { @@ -66,7 +66,7 @@ proc test_bbit { name taken } { } pass "$name single-step until bbit" gdb_test "si" "" "$name single-step on bbit" - if [regexp "li\\s+\[sv\]0,$taken" [current_insn]] { + if {[regexp "li\\s+\[sv\]0,$taken" [current_insn]]} { pass "$name check insn after bbit" } else { send_log "expected: li\\s+\[sv\]0,$taken found [current_insn]\n" diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp index ad246ca69ea..cb8eeeb7278 100644 --- a/gdb/testsuite/gdb.arch/pa-nullify.exp +++ b/gdb/testsuite/gdb.arch/pa-nullify.exp @@ -43,7 +43,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] ! clean_restart gdb_load $binfile -# In the first test, we do a "step" on a function whose last instruction +# In the first test, we do a "step" on a function whose last instruction # contains a branch-with-nullify. The instruction in the delay slot belongs # to the next function. We verify that when we step off the first function # that we end up back at the caller and not at the second instruction. @@ -65,9 +65,9 @@ gdb_test_multiple "stepi" "${test}" { } } -# In the second test, we verify that we can get a proper backtrace +# In the second test, we verify that we can get a proper backtrace # even when we are in a nullified instruction that belongs to the next function. -# We also verify that when stepping over a branch-with-nullify insn that we +# We also verify that when stepping over a branch-with-nullify insn that we # stay on the same insn for two steps. proc get_addr_of_sym { sym } { @@ -127,7 +127,7 @@ if {![runto_main]} { } gdb_breakpoint "*$foo_last" gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" -if [gen_core $test] { +if {[gen_core $test]} { test_core_bt $test } @@ -138,6 +138,6 @@ if {![runto_main]} { gdb_breakpoint "*$foo_last" gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" gdb_test "stepi" ".*in foo.*" "$test: step to nullified instruction" -if [gen_core $test] { +if {[gen_core $test]} { test_core_bt $test } diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp index 5a6d38e91d5..9d88c788908 100644 --- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp @@ -86,25 +86,25 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] # addpcis 8,+0x10 # /* set r8 */ # addpcis 9,+0x100 # /* set r9 */ -if [expr $check_r3 + 0x1000000 != $check_r6 - 0xc ] { +if {$check_r3 + 0x1000000 != $check_r6 - 0xc} { fail "unexpected value r3 + 0x1,000,000 != r6 + 0xc ; r3: $check_r3 r6: $check_r6 " } -if [expr $check_r4 + 0x100000 != $check_r6 - 0x8 ] { +if {$check_r4 + 0x100000 != $check_r6 - 0x8} { fail "unexpected value r4 + 0x100,000 != r6 - 0x8 ; r4: $check_r4 r6: $check_r6 " } -if [expr $check_r5 + 0x10000 != $check_r6 - 0x4 ] { +if {$check_r5 + 0x10000 != $check_r6 - 0x4} { fail "unexpected value r5 + 0x10,000 != r6 , r5: $check_r5 r6: $check_r6 " } -if [expr $check_r6 != $check_r6] { +if {$check_r6 != $check_r6} { fail "unexpected value r6 != r6 , r6: $check_r6 r6: $check_r6 " } -if [expr $check_r7 - 0x10000 != $check_r6 + 0x4] { +if {$check_r7 - 0x10000 != $check_r6 + 0x4} { fail "unexpected value r7 - 0x10,000 != r6 + 0x4 , r7: $check_r7 r7: $check_r6 " } -if [expr $check_r8 - 0x100000 != $check_r6 + 0x8 ] { +if {$check_r8 - 0x100000 != $check_r6 + 0x8} { fail "unexpected value r8 - 0x100,000 != r6 , r8: $check_r8 r8: $check_r6 " } -if [expr $check_r9 - 0x1000000 != $check_r6 + 0xc ] { +if {$check_r9 - 0x1000000 != $check_r6 + 0xc} { fail "unexpected value r9 - 0x1,000,000 != r6 + 0xc , r9: $check_r9 r6: $check_r6 " } diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp index f95bddf792b..4e6ee78b9fb 100644 --- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp +++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp @@ -38,7 +38,7 @@ proc insert_breakpoint {function expected_location} { global gdb_prompt global expect_out global hex - + set address "" # Insert a breakpoint using the given function name, and extract diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.exp b/gdb/testsuite/gdb.arch/powerpc-altivec.exp index bc8ff7a4f19..0084ffed898 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec.exp @@ -53,7 +53,7 @@ proc func_check {instr} { set test "found: '$instr'" set peb [instr_to_patt $instr] - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $peb diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp index 6fddd34edab..cd2240ad090 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp index 7b1d0c3d3a9..c7d1a2b9f1b 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp index cb5a37105b9..904c75881f1 100644 --- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp +++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp @@ -35,7 +35,7 @@ if {![runto_main]} { return } -if [gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"] { +if {[gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"]} { return -1 } @@ -50,12 +50,12 @@ gdb_test "info reg dl$i" \ "dl$i\[ \]*1\.2345678910\[ \t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \ "print dl$i register with the info reg command" -gdb_test "info reg f[expr 2*$i]" \ - "f[expr 2*$i]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \ +gdb_test "info reg f[expr {2*$i}]" \ + "f[expr {2*$i}]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \ "testing lower half of dl$i register" -gdb_test "info reg f[expr 2*$i+1]" \ - "f[expr 2*$i+1]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \ +gdb_test "info reg f[expr {2*$i+1}]" \ + "f[expr {2*$i+1}]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \ "testing upper half of dl$i register" } diff --git a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp index 5e2923fbd00..456833e662a 100644 --- a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp +++ b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp @@ -159,7 +159,7 @@ gdb_test_no_output "set \$xer = 0xc0000000" # FPRs gdb_test_no_output "set \$f0 = 0.5" for {set i 1} {$i < 32} {incr i 1} { - gdb_test_no_output "set \$f$i = \$f[expr $i - 1] + 1.0" + gdb_test_no_output "set \$f$i = \$f[expr {$i - 1}] + 1.0" } gdb_test_no_output "set \$fpscr = 0x84005000" @@ -213,7 +213,7 @@ proc test_register_match {reg_name reg_var_name hex} { # In some infrequent cases CXER doesn't match the # pre-transactional XER, possibly due to a linux kernel bug. set should_xfail 0 - if [istarget "powerpc*-*-linux*" && reg_name == "cxer"] { + if {[istarget "powerpc*-*-linux*" && reg_name == "cxer"]} { set should_xfail 1 } @@ -268,7 +268,7 @@ test_register_match "ctar" "tar" 1 # Support for writing to the checkpointed registers is not # currently available in the gdbserver stub. -if [target_is_gdbserver] { +if {[target_is_gdbserver]} { unsupported "write to checkpointed registers" return } @@ -282,7 +282,7 @@ for {set i 0} {$i < 32} {incr i 1} { gdb_test_no_output "set \$cf0 = 0.25" for {set i 1} {$i < 32} {incr i 1} { - gdb_test_no_output "set \$cf$i = \$cf[expr $i - 1] + 1.0" + gdb_test_no_output "set \$cf$i = \$cf[expr {$i - 1}] + 1.0" } for {set i 0} {$i < 32} {incr i 1} { diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp index 357ec7a5690..c317465c9ea 100644 --- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp +++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp @@ -82,22 +82,22 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] # Specifically that the values loaded by the lnia instruction # reflect the value of the PC as if the instruction was # not displaced. -if [expr $check_r3 + 4 != $check_r4] { +if {$check_r3 + 4 != $check_r4} { fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 " } -if [expr $check_r4 + 4 != $check_r5] { +if {$check_r4 + 4 != $check_r5} { fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 " } -if [expr $check_r5 + 4 != $check_r6] { +if {$check_r5 + 4 != $check_r6} { fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 " } -if [expr $check_r6 + 4 != $check_r7] { +if {$check_r6 + 4 != $check_r7} { fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 " } -if [expr $check_r7 + 4 != $check_r8] { +if {$check_r7 + 4 != $check_r8} { fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 " } -if [expr $check_r8 + 4 != $check_r9] { +if {$check_r8 + 4 != $check_r9} { fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 " } diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp index f4a3fdb7e37..ef6e1ff3947 100644 --- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp +++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp @@ -109,16 +109,16 @@ set vs5_expected 0xa7b7c7d7a6b6c6d6a5b5c5d5a4b4c4d4 set vs6_expected 0xa9b9c9d9a8b8c8d8a7b7c7d7a6b6c6d6 set vs7_expected 0xabbbcbdbaabacadaa9b9c9d9a8b8c8d8 -if [expr $check_vs4 != $vs4_expected] { +if {$check_vs4 != $vs4_expected} { fail "unexpected value vs4; actual:$check_vs4 expected:$vs4_expected" } -if [expr $check_vs5 != $vs5_expected ] { +if {$check_vs5 != $vs5_expected} { fail "unexpected value vs5; actual:$check_vs5 expected:$vs5_expected" } -if [expr $check_vs6 != $vs6_expected ] { +if {$check_vs6 != $vs6_expected} { fail "unexpected value vs6; actual:$check_vs6 expected:$vs6_expected" } -if [expr $check_vs7 != $vs7_expected ] { +if {$check_vs7 != $vs7_expected} { fail "unexpected value vs7; actual:$check_vs7 expected:$vs7_expected" } diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.exp b/gdb/testsuite/gdb.arch/powerpc-power10.exp index 124baaf4011..089ca737fd2 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power10.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power10.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp index 8885a916daa..4d85fd9fe82 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power7.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.exp b/gdb/testsuite/gdb.arch/powerpc-power8.exp index f740ae82d01..f679253f956 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power8.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power8.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.exp b/gdb/testsuite/gdb.arch/powerpc-power9.exp index 8dcf536b546..784ba9bad7b 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power9.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power9.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp index 1b4c6082703..1b705354746 100644 --- a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp +++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp @@ -68,7 +68,7 @@ proc ppr_dscr_available {} { with_test_prefix "check PPR/DSCR access" { clean_restart $::testfile - if ![runto_main] { + if {![runto_main]} { return } @@ -88,7 +88,7 @@ with_test_prefix "check PPR/DSCR access" { # Now do the actual test clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp index 156a70ef382..4682cb9453b 100644 --- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp +++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp @@ -28,7 +28,7 @@ if {[gdb_compile \ clean_restart $testfile -if ![runto bar] { +if {![runto bar]} { untested "could not run to bar" return -1 } diff --git a/gdb/testsuite/gdb.arch/powerpc-tar.exp b/gdb/testsuite/gdb.arch/powerpc-tar.exp index a060ec8d8a0..917d7595ec1 100644 --- a/gdb/testsuite/gdb.arch/powerpc-tar.exp +++ b/gdb/testsuite/gdb.arch/powerpc-tar.exp @@ -70,7 +70,7 @@ proc tar_available {} { with_test_prefix "check TAR access" { clean_restart $::testfile - if ![runto_main] { + if {![runto_main]} { return } @@ -86,7 +86,7 @@ with_test_prefix "check TAR access" { # Now do the actual test clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.exp b/gdb/testsuite/gdb.arch/powerpc-vsx.exp index 73a0fdcfa98..27f2bd08b20 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp index dfee7a396b8..ec09815d998 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp index fd725f98fd5..5aeed8e1ed3 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp index 20145ae6d67..3c3b0304ae1 100644 --- a/gdb/testsuite/gdb.arch/ppc-dfp.exp +++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp @@ -20,7 +20,7 @@ require {istarget "powerpc*"} standard_testfile -if ![test_compiler_info gcc*] { +if {![test_compiler_info gcc*]} { # We use GCC's extended asm syntax warning "unknown compiler" return -1 diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp index c8342bbb0f0..b8b3f004f0a 100644 --- a/gdb/testsuite/gdb.arch/ppc-fp.exp +++ b/gdb/testsuite/gdb.arch/ppc-fp.exp @@ -20,7 +20,7 @@ require {istarget "powerpc*"} standard_testfile -if ![test_compiler_info gcc*] { +if {![test_compiler_info gcc*]} { # We use GCC's extended asm syntax warning "unknown compiler" return -1 diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp index 17bbdb452a1..35b442f1cf9 100644 --- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp @@ -26,7 +26,7 @@ require {istarget "powerpc*"} is_lp64_target set flags { nodebug } -if [info exists COMPILE] { +if {[info exists COMPILE]} { standard_testfile .c -main.c lappend flags optimize=-O2 lappend flags additional_flags=-fno-stack-protector diff --git a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp index 62d4c4483a6..39aa7938314 100644 --- a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp +++ b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp @@ -31,7 +31,7 @@ if {![runto_main]} { # Figure out where the breakpoint will be placed taking account for # stack alignment, and allocation of the dummy code area. set bp_addr [get_valueof "/x" "\$sp" 0] -set bp_addr [format 0x%x [expr ($bp_addr & ~0xf) - 0x20]] +set bp_addr [format 0x%x [expr {($bp_addr & ~0xf) - 0x20}]] # Fill the region we know will be used as the scratch area with the # compressed nop instruction. If GDB fails to overwrite this with an diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp index 4b3baae4f9c..358544f3dba 100644 --- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp +++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp @@ -32,7 +32,7 @@ if {![runto_main]} { # that can be written to the fcsr register. The two arguments should # be the value of each of the two fields within the fcsr register. proc merge_fflags_and_frm { fflags_value frm_value } { - set fcsr_value 0x[format %x [expr $fflags_value | ($frm_value << 5)]] + set fcsr_value 0x[format %x [expr {$fflags_value | ($frm_value << 5)}]] return $fcsr_value } @@ -48,11 +48,11 @@ proc check_fcsr { fflags_value frm_value frm_string } { set frm_str_re [string_to_regexp "$frm_string"] set frm_val_re [format %d ${frm_value}] - set nv [format %d [expr ($fflags_value >> 4) & 0x1]] - set dz [format %d [expr ($fflags_value >> 3) & 0x1]] - set of [format %d [expr ($fflags_value >> 2) & 0x1]] - set uf [format %d [expr ($fflags_value >> 1) & 0x1]] - set nx [format %d [expr ($fflags_value >> 0) & 0x1]] + set nv [format %d [expr {($fflags_value >> 4) & 0x1}]] + set dz [format %d [expr {($fflags_value >> 3) & 0x1}]] + set of [format %d [expr {($fflags_value >> 2) & 0x1}]] + set uf [format %d [expr {($fflags_value >> 1) & 0x1}]] + set nx [format %d [expr {($fflags_value >> 0) & 0x1}]] set fflags_pattern "NV:${nv} DZ:${dz} OF:${of} UF:${uf} NX:${nx}" set frm_pattern "FRM:${frm_val_re} \\\[${frm_str_re}\\\]" diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp index 3e47cac25d8..9ee959bf4b8 100644 --- a/gdb/testsuite/gdb.arch/s390-vregs.exp +++ b/gdb/testsuite/gdb.arch/s390-vregs.exp @@ -19,7 +19,7 @@ require {is_any_target s390-*-* s390x-*-*} standard_testfile .S -if [isnative] { +if {[isnative]} { # Create a temporary directory, to take a core dump there later. set coredir [standard_output_file ${testfile}.d] remote_exec build "rm -rf $coredir" @@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -71,7 +71,7 @@ gdb_test_multiple "x/i \$pc" "get PC after vector insn" { } } -if [expr $before_pc + 6 != $after_pc] { +if {$before_pc + 6 != $after_pc} { fail "stepping first vector insn" } @@ -93,17 +93,17 @@ set a_low 2 set b_high 3 set b_low 5 -set a [expr ($a_high << 32) | $a_low] -set b [expr ($b_high << 32) | $b_low] +set a [expr {($a_high << 32) | $a_low}] +set b [expr {($b_high << 32) | $b_low}] for {set j 0} {$j < 32} {incr j 1} { - set i [expr 17 * $j % 32] + set i [expr {17 * $j % 32}] gdb_test_no_output \ - "set \$v$i.v2_int64\[0\] = [expr $a * ($i + 1)]" \ + "set \$v$i.v2_int64\[0\] = [expr {$a * ($i + 1)}]" \ "set v$i left" - set i [expr 19 * (31 - $j) % 32] + set i [expr {19 * (31 - $j) % 32}] gdb_test_no_output \ - "set \$v$i.v2_int64\[1\] = [expr $b * (32 - $i)]" \ + "set \$v$i.v2_int64\[1\] = [expr {$b * (32 - $i)}]" \ "set v$i right" } @@ -121,7 +121,7 @@ set vregs [capture_command_output "x/64xg &save_area" ""] set i 0 foreach {- left right} [regexp -all -inline -line {^.*:\s+(\w+)\s+(\w+)} $vregs] { - if [expr $left != $a * ($i + 1) || $right != $b * (32 - $i)] { + if {$left != $a * ($i + 1) || $right != $b * (32 - $i)} { fail "verify \$v$i after set" } if { $i < 16 } { @@ -157,10 +157,10 @@ foreach {- r i val} [regexp -all -inline -line \ if { $r ne "v" } { fail "info registers vector: bad line $j" } elseif { $val ne [hex128 \ - [expr $a_high * ($i + 1) * $a_high ] \ - [expr $a_low * ($i + 1) * $a_low ] \ - [expr $b_high * (32 - $i) * $b_high * 32] \ - [expr $b_low * (32 - $i) * $b_low * 32] ] } { + [expr {$a_high * ($i + 1) * $a_high }] \ + [expr {$a_low * ($i + 1) * $a_low }] \ + [expr {$b_high * (32 - $i) * $b_high * 32}] \ + [expr {$b_low * (32 - $i) * $b_low * 32}] ] } { fail "compare \$v$i" } incr j 1 diff --git a/gdb/testsuite/gdb.arch/skip-prologue.exp b/gdb/testsuite/gdb.arch/skip-prologue.exp index ec04dad0f38..26fd022ebbf 100644 --- a/gdb/testsuite/gdb.arch/skip-prologue.exp +++ b/gdb/testsuite/gdb.arch/skip-prologue.exp @@ -48,7 +48,7 @@ proc do_test { f } { } set test {$bp_addr == $prologue_end_addr} - if { [expr $test] } { + if {$bp_addr == $prologue_end_addr} { pass $test } elseif { $bp_addr < $prologue_end_addr } { # We'll allow this. For instance, amd64 has a prologue diff --git a/gdb/testsuite/gdb.arch/sparc-sysstep.exp b/gdb/testsuite/gdb.arch/sparc-sysstep.exp index 4dfc5143714..2a5c194dd6a 100644 --- a/gdb/testsuite/gdb.arch/sparc-sysstep.exp +++ b/gdb/testsuite/gdb.arch/sparc-sysstep.exp @@ -32,7 +32,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {additional_flag return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/sparc64-adi.exp b/gdb/testsuite/gdb.arch/sparc64-adi.exp index 25c3ce6057d..40a8eab1456 100644 --- a/gdb/testsuite/gdb.arch/sparc64-adi.exp +++ b/gdb/testsuite/gdb.arch/sparc64-adi.exp @@ -15,7 +15,7 @@ # This file is part of the gdb testsuite. -# Basic tests of examining/assigning ADI version tags, and reporting +# Basic tests of examining/assigning ADI version tags, and reporting # precise mismatch. require {istarget "sparc64*-*-linux*"} diff --git a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp index 13622ebfcd8..e5699d73206 100644 --- a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp +++ b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp @@ -21,7 +21,7 @@ set testfile "thumb-bx-pc" set srcfile ${testfile}.S set opts {} -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/thumb-singlestep.exp b/gdb/testsuite/gdb.arch/thumb-singlestep.exp index f4f695acfb2..88fe49b4612 100644 --- a/gdb/testsuite/gdb.arch/thumb-singlestep.exp +++ b/gdb/testsuite/gdb.arch/thumb-singlestep.exp @@ -21,7 +21,7 @@ set testfile "thumb-singlestep" set srcfile ${testfile}.S set additional_flags "additional_flags=-mthumb" -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp index df74ef35e55..a6ecbfdd67c 100644 --- a/gdb/testsuite/gdb.arch/vsx-regs.exp +++ b/gdb/testsuite/gdb.arch/vsx-regs.exp @@ -24,9 +24,9 @@ require {istarget "powerpc*"} allow_vsx_tests standard_testfile set compile_flags {debug nowarnings quiet} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler" diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp index e40d52cd5b3..76c38ff2a79 100644 --- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp +++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp @@ -23,9 +23,9 @@ require {istarget "powerpc*"} allow_vsx_tests standard_testfile set compile_flags {debug nowarnings quiet} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler"