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

Fix these.

Tested on x86_64-linux.

46 files changed:
gdb/tclint.toml
gdb/testsuite/gdb.python/py-arch-reg-groups.exp
gdb/testsuite/gdb.python/py-arch-reg-names.exp
gdb/testsuite/gdb.python/py-arch.exp
gdb/testsuite/gdb.python/py-as-string.exp
gdb/testsuite/gdb.python/py-auto-load-chaining.exp
gdb/testsuite/gdb.python/py-bp-locations.exp
gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp
gdb/testsuite/gdb.python/py-caller-is.exp
gdb/testsuite/gdb.python/py-explore-cc.exp
gdb/testsuite/gdb.python/py-explore.exp
gdb/testsuite/gdb.python/py-finish-breakpoint.exp
gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
gdb/testsuite/gdb.python/py-format-address.exp
gdb/testsuite/gdb.python/py-format-string.exp
gdb/testsuite/gdb.python/py-frame-args.exp
gdb/testsuite/gdb.python/py-framefilter-addr.exp
gdb/testsuite/gdb.python/py-inferior.exp
gdb/testsuite/gdb.python/py-label-symbol-value.exp
gdb/testsuite/gdb.python/py-lazy-string.exp
gdb/testsuite/gdb.python/py-linetable-empty.exp
gdb/testsuite/gdb.python/py-linetable.exp
gdb/testsuite/gdb.python/py-mi-events.exp
gdb/testsuite/gdb.python/py-mi-objfile.exp
gdb/testsuite/gdb.python/py-objfile-script.exp
gdb/testsuite/gdb.python/py-objfile.exp
gdb/testsuite/gdb.python/py-parameter.exp
gdb/testsuite/gdb.python/py-pp-cast.exp
gdb/testsuite/gdb.python/py-pp-integral.exp
gdb/testsuite/gdb.python/py-pp-maint.exp
gdb/testsuite/gdb.python/py-pp-re-notag.exp
gdb/testsuite/gdb.python/py-pp-registration.exp
gdb/testsuite/gdb.python/py-prettyprint.exp
gdb/testsuite/gdb.python/py-progspace.exp
gdb/testsuite/gdb.python/py-read-memory-leak.exp
gdb/testsuite/gdb.python/py-record-btrace.exp
gdb/testsuite/gdb.python/py-record-full.exp
gdb/testsuite/gdb.python/py-section-script.exp
gdb/testsuite/gdb.python/py-source-styling.exp
gdb/testsuite/gdb.python/py-strfns.exp
gdb/testsuite/gdb.python/py-thread-exited.exp
gdb/testsuite/gdb.python/py-type.exp
gdb/testsuite/gdb.python/py-value-cc.exp
gdb/testsuite/gdb.python/py-value.exp
gdb/testsuite/gdb.python/py-xmethods.exp
gdb/testsuite/gdb.python/python.exp

index 1c9f99b1e14fbf43dc4429b7eaa3cdc917b4657c..a69e2b53e4a1700f3a75d7fc858c0e40a379e2dc 100644 (file)
@@ -25,7 +25,6 @@ exclude = [
 "gdb/testsuite/gdb.cp",
 "gdb/testsuite/gdb.dwarf2",
 "gdb/testsuite/gdb.mi",
-"gdb/testsuite/gdb.python",
 "gdb/testsuite/gdb.threads",
 "gdb/testsuite/gdb.trace",
 # IGNORE (document reason in trailing comment):
index 855af278baeaabcacaf650ceaac0a1b9dbc67d6b..2b0ac3ec6891a1ae7ef2a869f948e96d778786d4 100644 (file)
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 7093674d6ee4da6474a1ab1f1f197a5a0bd4261a..99fb8ce1544dae25a863f5d052e77f758312f745 100644 (file)
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 79e5939828296440a654a581cd3852d1d64e3781..531ae5011ec65ea210095f3a41943cf7f4da87e2 100644 (file)
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
@@ -78,7 +78,7 @@ foreach size {0 1 2 3 4 8 16} {
        } else {
            set sign_result [lindex $sign_data 1]
        }
-       set fullsize [expr 8 * $size]
+       set fullsize [expr {8 * $size}]
        gdb_test_no_output "python t = arch.integer_type($fullsize$sign)" \
            "get integer type for $size$sign"
        gdb_test "python print(t.sizeof)" "$size" \
index 05d55dfad0e1b2b15ba158a9a64235f07b0e20f7..2ad179d292475c6cffcfb4a957339278a19b0d36 100644 (file)
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
index 451dca635409d5ba1d85cc3309fdbde18718a3ac..fbb95d9f90ab66f31087cce2845552ad18259e1a 100644 (file)
@@ -49,7 +49,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 61e4e385238d17374625d825a0cf778b956b64d2..b09a401f6d79912f17290b1c5c8c9a4836c3a3f4 100644 (file)
@@ -27,7 +27,7 @@ save_vars { GDBFLAGS } {
     clean_restart $testfile
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
@@ -79,7 +79,7 @@ gdb_test "python print(gdb.breakpoints()\[1\].locations\[0\])" \
     "check repr of disabled breakpoint location"
 gdb_continue_to_breakpoint "" ".*25.*"
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 391744e0ac0e2190017dc1da3fd367c03a6543a6..4098a7a824dbbdf15612ef3e6ca32acb720caeac 100644 (file)
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 }
 
 clean_restart "${testfile}"
-if ![runto_main] {
+if {![runto_main]} {
     return
 }
 
index 8e54c3be27345c173c3c4902236d5d3d09513279..0fdb80e7805fada80439a90b29a4896696d741c2 100644 (file)
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
index 0be7019f6c1d32c50f1eeed15cc7a1c619c60e44..8c28d874e5556f84b0fd12954fa593b471b56927 100644 (file)
@@ -36,7 +36,7 @@ A = <Enter 0 to explore this base class of type 'A'>.*\
 i = <Enter 1 to explore this field of type 'int'>.*\
 c = <Enter 2 to explore this field of type 'char'>.*"
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index a68c110874f7f06f5da23c37f195ca07571f2aad..df0f4654593abeb84fc3dfa591e3cf6b2742506c 100644 (file)
@@ -47,7 +47,7 @@ proc array_description { value_name type } {
 
 proc pointer_description { value_name type_name } {
     set type_description "'$value_name' is a pointer to a value of type '$type_name'\.\[\r\n\]+"
-    set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: " 
+    set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: "
     return "$type_description$prompt"
 }
 
@@ -75,7 +75,7 @@ proc scalar_value { value_name value } {
 
 set SS_fields [field_values {a = 10} {d = 100[.].*}]
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
@@ -125,7 +125,7 @@ gdb_test_multiple "explore darray_ref" "" {
                                     }
                                 }
                             }
-                        } 
+                        }
                     }
                 }
             }
index c7d31f01937b271a10b297105664de81c5cef320..bec22eebc9c28915f3c1b2a705a6751f1e636e90 100644 (file)
@@ -112,7 +112,7 @@ with_test_prefix "return to inlined function" {
 }
 
 #
-# Test FinishBreakpoint with no debug symbol 
+# Test FinishBreakpoint with no debug symbol
 #
 
 with_test_prefix "no debug symbol" {
@@ -140,7 +140,7 @@ with_test_prefix "no debug symbol" {
 }
 
 #
-# Test FinishBreakpoint in function returned by longjmp 
+# Test FinishBreakpoint in function returned by longjmp
 #
 
 with_test_prefix "function returned by longjump" {
@@ -166,7 +166,7 @@ with_test_prefix "function returned by longjump" {
 }
 
 #
-# Test FinishBreakpoint in BP condition evaluation 
+# Test FinishBreakpoint in BP condition evaluation
 # (finish in dummy frame)
 #
 
@@ -194,7 +194,7 @@ with_test_prefix "finish in dummy frame" {
 }
 
 #
-# Test FinishBreakpoint in BP condition evaluation 
+# Test FinishBreakpoint in BP condition evaluation
 # (finish in normal frame)
 #
 
index 922426ffdc0ee06197581f514f665388775f9592..be81576ed8d50a878bf77420d397f7e9843ae203 100644 (file)
@@ -42,7 +42,7 @@ gdb_breakpoint [gdb_get_line_number "Break after exception 2"]
 
 gdb_test "source $pyfile" ".*Python script imported.*" \
          "import python scripts"
-         
+
 gdb_breakpoint "throw_exception_1"
 
 #
index dd35627b57322f6d142a025d3498a6f77dfcb114..29463141574e0b3f0b3563b8d8c7c40d75a6f306 100644 (file)
@@ -34,7 +34,7 @@ set binary_bar [standard_output_file $testfile_bar]
 
 clean_restart $testfile_foo
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
@@ -53,7 +53,7 @@ gdb_test_multiple "info break 1" "" {
     }
 }
 if { $next_addr == "UNKNOWN" || $next_addr == $main_addr } {
-    set next_addr [format 0x%x [expr $main_addr + 1]]
+    set next_addr [format 0x%x [expr {$main_addr + 1}]]
 }
 
 verbose -log "main_addr: $main_addr"
index 8f38c182bc3fb22597fb0fa244b37f06640250ed..f34108d9998d39fdc87e9f07fc0f1faacc2d2845 100644 (file)
@@ -110,7 +110,7 @@ proc get_cut_big_string { max } {
     return "\"${whole_big_string}\""
   }
 
-  set cut_string [string range $whole_big_string 0 [expr $max - 1]]
+  set cut_string [string range $whole_big_string 0 [expr {$max - 1}]]
   return "\"${cut_string}\"..."
 }
 
index 1dbd30edc8df639d0bf658a156242a7ffd3c2dad..12f16511101fc2338c57bdcedc615b45cb251b80 100644 (file)
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 14eebc29a787e80638f270c813cfe600d7175bd5..27c1de3bc21c1ec13930272c35196d66f50a5a07 100644 (file)
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 62af1a48feee4c9207a85ea45a870bf827d2fe37..58632f084d471e68709516012fa963f24d5a9e19 100644 (file)
@@ -318,7 +318,7 @@ with_test_prefix "large range" {
 
 # For native targets, test a pattern straddling a chunk boundary.
 
-if [isnative] {
+if {[isnative]} {
     with_test_prefix "straddling" {
        gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531"
        gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)"
index ca534d471d6a46054790aeb850097fcd017f8f51..07bc870e2032943efa2a9bdd771a563c24f76e6a 100644 (file)
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 7e7272e2b81132f0ce6e1ece1be689216075a7c4..a6fdd77f5079d66d050009eb4b369bf6e9019f13 100644 (file)
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 
-if ![runto_main ] {
+if {![runto_main ]} {
     return -1
 }
 
index 55f4fedc97747ca2fd94c3ff8026e488737a11aa..f742d70d481c5150ac15f747d5c317b6e6d99268 100644 (file)
@@ -42,7 +42,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
        return -1
 }
 
index d27d16edc5da8bca3ce5e6285e5137147a402f3a..453ee7af1e1f0eee5eb98908dbcaa15847713db8 100644 (file)
@@ -18,7 +18,7 @@ require allow_python_tests
 set opts {}
 standard_testfile .S
 
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
     # make check RUNTESTFLAGS="gdb.python/py-linetable.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_main] {
+if {![runto_main]} {
     return -1
 }
 
index ecdb74ade47a13626a44c0c28004e374d4784f0c..a15ba0b0d9db81fc4be774c51325a4c62814e56f 100644 (file)
@@ -39,7 +39,7 @@ mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
     {.*\^done} \
     "set safe-path"
 
-if [is_remote host] {
+if {[is_remote host]} {
     set filename ${testfile}
     remote_download host ${binfile} ${filename}
 } else {
index 39bac2b8fc9a3774b843a7f17ee1db7a554f54af..c1edffeb269086316a1829cad3ef25aa53323a55 100644 (file)
@@ -41,7 +41,7 @@ mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
     {.*\^done} \
     "set safe-path"
 
-if [is_remote host] {
+if {[is_remote host]} {
     set filename ${testfile}
     remote_download host ${binfile} ${filename}
 } else {
index 1a3d394553408bae73d6368e734cde349c646a93..4e6f5b602f615ec15172d83fc7b7f0420bb8b309 100644 (file)
@@ -41,7 +41,7 @@ gdb_load ${binfile}
 # Verify gdb loaded the script.
 gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*"
 
-if ![runto_main] {
+if {![runto_main]} {
     return
 }
 
index befdb9116ec6650b7d9846b60ba1b1cf526075c1..ce4e37a1939200c45eb614d7da925fc0c4fb3801 100644 (file)
@@ -68,7 +68,7 @@ gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").lookup_static_symbo
     "None" "lookup_static_symbol can handle nonexistent symbol"
 
 set binfile_build_id [get_build_id $binfile]
-if [string compare $binfile_build_id ""] {
+if {[string compare $binfile_build_id ""]} {
     verbose -log "binfile_build_id = $binfile_build_id"
     gdb_test "python print (objfile.build_id)" "$binfile_build_id" \
     "Get objfile build id"
@@ -119,7 +119,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}2 ${srcfile} {nodebug l
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
@@ -158,11 +158,11 @@ if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
 # An objfile that was a symlink to a differently named file is still
 # findable with its original name.
 # On Windows we don't have proper symlinks, so skip this.
-if ![ishost *-*-mingw*] {
+if {![ishost *-*-mingw*]} {
     set symlink_binary [standard_output_file "symlink-binary"]
     remote_exec host "rm -f ${symlink_binary}"
     remote_exec host "ln -sf ${testfile} ${symlink_binary}"
-    if [remote_file host exists "${symlink_binary}"] {
+    if {[remote_file host exists "${symlink_binary}"]} {
        clean_restart
        gdb_load "${symlink_binary}"
        gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
index 30a477bdb26b24eacf181da7f4f2d1da344d4833..1d7f22b7b800f3e9d8e820b012f01f9d669d9fbe 100644 (file)
@@ -24,7 +24,7 @@ require allow_python_tests
 clean_restart
 
 proc py_param_test_maybe_no_output { command pattern args } {
-    if [string length $pattern] {
+    if {[string length $pattern]} {
        gdb_test $command $pattern $args
     } else {
        gdb_test_no_output $command $args
index 7e2075639074e0d5bb8f271245b5422e9037e1fc..917547c73ac755cdf8817a587b8d1ad4542e1abb 100644 (file)
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto break_function] {
+if {![runto break_function]} {
     return -1
 }
 
index 8111d75fbfc3f9e3583daa9800eb5743b738b4e6..45645f9411cc7f1900feb61d56fe79f1d4494717 100644 (file)
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto tick_tock] {
+if {![runto tick_tock]} {
     return -1
 }
 
index c87f30da975d1ae2442886901e44981379a9c1ec..bd26b91b7b6b444f37b2cc41f0dda26fbe0dce9f 100644 (file)
@@ -72,7 +72,7 @@ gdb_test "enable pretty-printer" \
     "second enable of all pretty printers"
 
 gdb_test "disable pretty-printer global lookup_function_lookup_test" \
-    "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"
+    "1 printer disabled.*[expr {$num_pp - 1}] of $num_pp printers enabled"
 
 gdb_test "disable pretty-printer global pp-test;.*" \
     "[expr {$num_pp - 1}] printers disabled.*0 of $num_pp printers enabled"
@@ -101,10 +101,10 @@ gdb_test "enable pretty-printer global pp-test" \
     "0 printers enabled.*1 of $num_pp printers enabled"
 
 gdb_test "enable pretty-printer global pp-test;.*ss.*" \
-    "2 printers enabled.*[expr $num_pp - 3] of $num_pp printers enabled"
+    "2 printers enabled.*[expr {$num_pp - 3}] of $num_pp printers enabled"
 
 gdb_test "enable pretty-printer global pp-test;.*s.*" \
-    "2 printers enabled.*[expr $num_pp - 1] of $num_pp printers enabled"
+    "2 printers enabled.*[expr {$num_pp - 1}] of $num_pp printers enabled"
 
 gdb_test "enable pretty-printer global pp-test;.*" \
     "1 printer enabled.*$num_pp of $num_pp printers enabled"
index 8111d75fbfc3f9e3583daa9800eb5743b738b4e6..45645f9411cc7f1900feb61d56fe79f1d4494717 100644 (file)
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto tick_tock] {
+if {![runto tick_tock]} {
     return -1
 }
 
index c5e7f9aeb585378a54332061f4a5851726af5114..d0d1fda8d53586f00612b998034b5921da2f227e 100644 (file)
@@ -29,7 +29,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
 
-if ![runto_main ] {
+if {![runto_main ]} {
     return -1
 }
 
@@ -40,7 +40,7 @@ proc prepare_test { } {
     clean_restart ${testfile}
 
     set run_to_here [gdb_get_line_number {break to inspect} ${testfile}.c ]
-    if ![runto ${testfile}.c:$run_to_here] {
+    if {![runto ${testfile}.c:$run_to_here]} {
        return 0
     }
 
@@ -63,7 +63,7 @@ proc test_printers { s_prefix } {
 # Test registration with verbose off.
 
 with_test_prefix "verbose off" {
-    if ![prepare_test] {
+    if {![prepare_test]} {
        return -1
     }
 
@@ -78,7 +78,7 @@ with_test_prefix "verbose off" {
 # Test registration with verbose on.
 
 with_test_prefix "verbose on" {
-    if ![prepare_test] {
+    if {![prepare_test]} {
        return -1
     }
 
@@ -95,7 +95,7 @@ with_test_prefix "verbose on" {
 # Exercise the "replace" argument to register_pretty_printer.
 
 with_test_prefix "replace" {
-    if ![prepare_test] {
+    if {![prepare_test]} {
        return -1
     }
 
index c342d453a9a8118fbc28971e958a1d74ded610ce..be2cecdab67482c3e43529803627100bc40bdc84 100644 (file)
@@ -53,11 +53,11 @@ proc run_lang_tests {exefile lang} {
                                ${srcdir}/${subdir}/${testfile}.py]
 
     gdb_test_no_output "source ${remote_python_file}" "load python file"
-    
+
     gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
     gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
     gdb_test "print ssa" " = {a=< a=<3> b=<$hex>> b=< a=<4> b=<$hex>>, a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>}"
-    
+
     gdb_test "print arraystruct" " = {$nl *y = 7, *$nl *x = { a=<23> b=<$hex>,  a=<24> b=<$hex>} *$nl *}"
 
     # Test that when a pretty-printer returns a gdb.Value in its to_string, we
index 1d271d4e89ab86314760a093d1b86f517a5dd515..822c079682b39833567c233a76098585214dc514 100644 (file)
@@ -76,7 +76,7 @@ gdb_test "python print (blk.end >= ${pc_val})" "True" \
     "block end is after \$pc"
 
 # Check what happens when we ask for a block of an invalid address.
-if ![is_address_zero_readable] {
+if {![is_address_zero_readable]} {
     gdb_test "python print (gdb.current_progspace ().block_for_pc (0))" "None"
 }
 
index 9ae5eb8a5ebd0d24c0b33bb63f8ea2e31fc35624..0b663d72cdacca8030e68795b0e48de92abfd290 100644 (file)
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index aff7c6c7403c5fc8e72f7af023a5e941bd461bdd..6dd3ae172390b9c644d5ac1fc3bdf2643ff2db2a 100644 (file)
@@ -23,7 +23,7 @@ load_lib gdb-python.exp
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
 
 if {![runto_main]} {
     return -1
index 97d21ce97b33811b80f28bf3ec87586701725a10..790e5b33f5f848abd9fe1b241e21bee36ab06685 100644 (file)
@@ -23,7 +23,7 @@ load_lib gdb-python.exp
 
 standard_testfile
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
 
 if {![runto_main]} {
     return -1
index cc4425cf040d4313442d9d79f97191d993e0111d..9d4e48c0cf739f12bfba7e3ccf3213e7df2ea7c5 100644 (file)
@@ -71,13 +71,13 @@ clean_restart
 
 # Get the name of the binfile on the host; on a remote host this means
 # stripping off any directory prefix.
-if [is_remote host] {
+if {[is_remote host]} {
     set remote_binfile [file tail ${binfile}]
 } else {
     set remote_binfile ${binfile}
 }
 
-if [ishost *-*-mingw*] {
+if {[ishost *-*-mingw*]} {
     set remote_pathsep ";"
 } else {
     set remote_pathsep ":"
@@ -107,7 +107,7 @@ gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*"
 gdb_test "info auto-load python-scripts no-script-matches-this" \
   "No auto-load scripts matching no-script-matches-this."
 
-if ![runto_main] {
+if {![runto_main]} {
     return
 }
 
index 5d7935629a5739b5418c8f56a9bc905bef7d826e..e030768a16a23daaa7bcbde8960f318f04ac6e7e 100644 (file)
@@ -75,7 +75,7 @@ proc test_pygments_styling {} {
        return
     }
 
-    if ![runto_main] {
+    if {![runto_main]} {
        return
     }
 
index 2b5dff19d055b97e7c9bf01bfa7fa080241ef1f5..13b8d2e2650dd268876ab9b76f07a56539c4fe3f 100644 (file)
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
     return 0
 }
 
index dcacb1140327cfdbafaa8569d0ec8b5b2c92cd12..0f47ce00745f9beaf94ef8d96045339ca5255147 100644 (file)
@@ -32,7 +32,7 @@ gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-events" "Event testers registered."
 
-if ![runto_main] {
+if {![runto_main]} {
     return -1
 }
 
index 5472482717d9164e3fa1086670266d0601952cd7..c32a5bdf947b5e18d3e0968d3749c45a9240ba55 100644 (file)
@@ -33,7 +33,7 @@ proc build_inferior {exefile lang} {
 }
 
 # Restart GDB.
-proc restart_gdb {exefile} { 
+proc restart_gdb {exefile} {
   clean_restart
   gdb_load $exefile
 
@@ -135,7 +135,7 @@ proc test_fields {lang} {
 
     # Test conversion to bool on scalar types
     gdb_test "python print (not not st.type\['a'\].type)" "True"
-  
+
     # Test regression PR python/10805
     gdb_py_test_silent_cmd "print (ar)" "print value(ar)" 1
     gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1
@@ -254,9 +254,9 @@ proc test_template {} {
        || [test_compiler_info {gcc-4-[0-4]-*}]} {
        set have_older_gcc 1
     }
-    if $have_older_gcc { setup_xfail *-*-* }
+    if {$have_older_gcc} { setup_xfail *-*-* }
     gdb_test "python print (ttype.template_argument(1))" "23"
-    if $have_older_gcc { setup_xfail *-*-* }
+    if {$have_older_gcc} { setup_xfail *-*-* }
     gdb_test "python print (isinstance(ttype.template_argument(1), gdb.Value))" \
        "True"
 
index 3d371bc07e2bdd7f31e836386807b56d119fd032..6d261fb3520a239c20e6e96847856665dcf8d876 100644 (file)
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index b4e80a21135213a50df1d4ca261701319459f3af..087c8c2c5bd40b05bbb1ce48c33bda8c0066166d 100644 (file)
@@ -297,9 +297,9 @@ proc test_value_in_inferior {} {
   gdb_test "print argc" " = $argc_value" "sanity check argc"
   gdb_test "python print (argc_lazy.is_lazy)" "\r\nTrue" \
       "python print (argc_lazy.is_lazy) the second time"
-  gdb_test_no_output "set argc=[expr $argc_value + 1]" "change argc"
+  gdb_test_no_output "set argc=[expr {$argc_value + 1}]" "change argc"
   gdb_test "python print (argc_notlazy)" "\r\n$argc_value"
-  gdb_test "python print (argc_lazy)" "\r\n[expr $argc_value + 1]"
+  gdb_test "python print (argc_lazy)" "\r\n[expr {$argc_value + 1}]"
   gdb_test "python print (argc_lazy.is_lazy)" "False"
 
   # Test string fetches,  both partial and whole.
@@ -598,7 +598,7 @@ proc test_value_from_buffer {} {
   gdb_py_test_silent_cmd "python atpbig=tp.array(3)" "make bigger array type" 0
   gdb_test "python vabig=gdb.Value(b,atpbig)" \
            "ValueError.*: Size of type is larger than that of buffer object\..*" \
-          "attempt to construct large value with small buffer" 
+          "attempt to construct large value with small buffer"
   gdb_test "python v=gdb.Value(2048,tp)" \
            "TypeError.*: Object must support the python buffer protocol\..*" \
            "attempt to construct value from buffer with non-buffer object"
@@ -770,7 +770,7 @@ proc test_assign {} {
 proc test_unavailable {} {
     set elem_size [get_valueof "/d" "sizeof(long_array\[0\])" "UNKNOWN" \
                       "get size of long_array element"]
-    set max [expr $elem_size * 10]
+    set max [expr {$elem_size * 10}]
 
     with_set "print elements" 5 {
        with_max_value_size $max {
@@ -834,7 +834,7 @@ test_assign
 test_value_bytes
 test_value_after_death
 
-# Test either C or C++ values. 
+# Test either C or C++ values.
 
 test_subscript_regression "${binfile}" "c"
 
index 3dafe0e30930f7aa755d68603518c97bd8d421cb..5863ec59ef0a78c90113654f0bbdf254f8fa196b 100644 (file)
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 
-if ![runto_main] {
+if {![runto_main]} {
    return -1
 }
 
index 96977dff629e7192538a81e8e1d6c7d4e2bdb21c..020fc66488a3b519f5bc25b1c89790072989cdf9 100644 (file)
@@ -158,7 +158,7 @@ gdb_test_multiple "python print (\"\\n\" * $lines)" $test {
 }
 gdb_test "q" "Quit.*" "verify pagination beforehand: q"
 
-gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=True) == \"\\n\" * [expr $lines + 1]: print (\"yes\")" "yes" "gdb.execute does not page"
+gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=True) == \"\\n\" * [expr {$lines + 1}]: print (\"yes\")" "yes" "gdb.execute does not page"
 
 set test "verify pagination afterwards"
 gdb_test_multiple "python print (\"\\n\" * $lines)" $test {
@@ -288,7 +288,7 @@ gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "test default write"
 gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "test stderr write"
 gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "test stdout write"
 
-if ![gdb_debug_enabled] {
+if {![gdb_debug_enabled]} {
   gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "test stdlog write"
 }