From: Tom de Vries Date: Sat, 20 Sep 2025 12:48:57 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.python X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5284233635417cd5e30b2044976a64cafc2fc8d;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.python Running tclint on the test-cases in gdb.python shows a few problems. Fix these. Tested on x86_64-linux. --- diff --git a/gdb/tclint.toml b/gdb/tclint.toml index 1c9f99b1e14..a69e2b53e4a 100644 --- a/gdb/tclint.toml +++ b/gdb/tclint.toml @@ -25,7 +25,6 @@ exclude = [ "gdb/testsuite/gdb.cp", "gdb/testsuite/gdb.dwarf2", "gdb/testsuite/gdb.mi", -"gdb/testsuite/gdb.python", "gdb/testsuite/gdb.threads", "gdb/testsuite/gdb.trace", # IGNORE (document reason in trailing comment): diff --git a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp index 855af278bae..2b0ac3ec689 100644 --- a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp +++ b/gdb/testsuite/gdb.python/py-arch-reg-groups.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.python/py-arch-reg-names.exp b/gdb/testsuite/gdb.python/py-arch-reg-names.exp index 7093674d6ee..99fb8ce1544 100644 --- a/gdb/testsuite/gdb.python/py-arch-reg-names.exp +++ b/gdb/testsuite/gdb.python/py-arch-reg-names.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.python/py-arch.exp b/gdb/testsuite/gdb.python/py-arch.exp index 79e59398282..531ae5011ec 100644 --- a/gdb/testsuite/gdb.python/py-arch.exp +++ b/gdb/testsuite/gdb.python/py-arch.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.python/py-as-string.exp b/gdb/testsuite/gdb.python/py-as-string.exp index 05d55dfad0e..2ad179d2924 100644 --- a/gdb/testsuite/gdb.python/py-as-string.exp +++ b/gdb/testsuite/gdb.python/py-as-string.exp @@ -26,7 +26,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.python/py-auto-load-chaining.exp b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp index 451dca63540..fbb95d9f90a 100644 --- a/gdb/testsuite/gdb.python/py-auto-load-chaining.exp +++ b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp @@ -49,7 +49,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.python/py-bp-locations.exp b/gdb/testsuite/gdb.python/py-bp-locations.exp index 61e4e385238..b09a401f6d7 100644 --- a/gdb/testsuite/gdb.python/py-bp-locations.exp +++ b/gdb/testsuite/gdb.python/py-bp-locations.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp index 391744e0ac0..4098a7a824d 100644 --- a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp +++ b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp @@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { } clean_restart "${testfile}" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.python/py-caller-is.exp b/gdb/testsuite/gdb.python/py-caller-is.exp index 8e54c3be273..0fdb80e7805 100644 --- a/gdb/testsuite/gdb.python/py-caller-is.exp +++ b/gdb/testsuite/gdb.python/py-caller-is.exp @@ -26,7 +26,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.python/py-explore-cc.exp b/gdb/testsuite/gdb.python/py-explore-cc.exp index 0be7019f6c1..8c28d874e55 100644 --- a/gdb/testsuite/gdb.python/py-explore-cc.exp +++ b/gdb/testsuite/gdb.python/py-explore-cc.exp @@ -36,7 +36,7 @@ A = .*\ i = .*\ c = .*" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-explore.exp b/gdb/testsuite/gdb.python/py-explore.exp index a68c110874f..df0f4654593 100644 --- a/gdb/testsuite/gdb.python/py-explore.exp +++ b/gdb/testsuite/gdb.python/py-explore.exp @@ -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" "" { } } } - } + } } } } diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp index c7d31f01937..bec22eebc9c 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp @@ -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) # diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp index 922426ffdc0..be81576ed8d 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp @@ -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" # diff --git a/gdb/testsuite/gdb.python/py-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp index dd35627b573..29463141574 100644 --- a/gdb/testsuite/gdb.python/py-format-address.exp +++ b/gdb/testsuite/gdb.python/py-format-address.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp index 8f38c182bc3..f34108d9998 100644 --- a/gdb/testsuite/gdb.python/py-format-string.exp +++ b/gdb/testsuite/gdb.python/py-format-string.exp @@ -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}\"..." } diff --git a/gdb/testsuite/gdb.python/py-frame-args.exp b/gdb/testsuite/gdb.python/py-frame-args.exp index 1dbd30edc8d..12f16511101 100644 --- a/gdb/testsuite/gdb.python/py-frame-args.exp +++ b/gdb/testsuite/gdb.python/py-frame-args.exp @@ -21,7 +21,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.python/py-framefilter-addr.exp b/gdb/testsuite/gdb.python/py-framefilter-addr.exp index 14eebc29a78..27c1de3bc21 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-addr.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-addr.exp @@ -27,7 +27,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.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index 62af1a48fee..58632f084d4 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -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)" diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.exp b/gdb/testsuite/gdb.python/py-label-symbol-value.exp index ca534d471d6..07bc870e203 100644 --- a/gdb/testsuite/gdb.python/py-label-symbol-value.exp +++ b/gdb/testsuite/gdb.python/py-label-symbol-value.exp @@ -24,7 +24,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.python/py-lazy-string.exp b/gdb/testsuite/gdb.python/py-lazy-string.exp index 7e7272e2b81..a6fdd77f507 100644 --- a/gdb/testsuite/gdb.python/py-lazy-string.exp +++ b/gdb/testsuite/gdb.python/py-lazy-string.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-linetable-empty.exp b/gdb/testsuite/gdb.python/py-linetable-empty.exp index 55f4fedc977..f742d70d481 100644 --- a/gdb/testsuite/gdb.python/py-linetable-empty.exp +++ b/gdb/testsuite/gdb.python/py-linetable-empty.exp @@ -42,7 +42,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.python/py-linetable.exp index d27d16edc5d..453ee7af1e1 100644 --- a/gdb/testsuite/gdb.python/py-linetable.exp +++ b/gdb/testsuite/gdb.python/py-linetable.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-mi-events.exp b/gdb/testsuite/gdb.python/py-mi-events.exp index ecdb74ade47..a15ba0b0d9d 100644 --- a/gdb/testsuite/gdb.python/py-mi-events.exp +++ b/gdb/testsuite/gdb.python/py-mi-events.exp @@ -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 { diff --git a/gdb/testsuite/gdb.python/py-mi-objfile.exp b/gdb/testsuite/gdb.python/py-mi-objfile.exp index 39bac2b8fc9..c1edffeb269 100644 --- a/gdb/testsuite/gdb.python/py-mi-objfile.exp +++ b/gdb/testsuite/gdb.python/py-mi-objfile.exp @@ -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 { diff --git a/gdb/testsuite/gdb.python/py-objfile-script.exp b/gdb/testsuite/gdb.python/py-objfile-script.exp index 1a3d3945534..4e6f5b602f6 100644 --- a/gdb/testsuite/gdb.python/py-objfile-script.exp +++ b/gdb/testsuite/gdb.python/py-objfile-script.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp index befdb9116ec..ce4e37a1939 100644 --- a/gdb/testsuite/gdb.python/py-objfile.exp +++ b/gdb/testsuite/gdb.python/py-objfile.exp @@ -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)" \ diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp index 30a477bdb26..1d7f22b7b80 100644 --- a/gdb/testsuite/gdb.python/py-parameter.exp +++ b/gdb/testsuite/gdb.python/py-parameter.exp @@ -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 diff --git a/gdb/testsuite/gdb.python/py-pp-cast.exp b/gdb/testsuite/gdb.python/py-pp-cast.exp index 7e207563907..917547c73ac 100644 --- a/gdb/testsuite/gdb.python/py-pp-cast.exp +++ b/gdb/testsuite/gdb.python/py-pp-cast.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-pp-integral.exp b/gdb/testsuite/gdb.python/py-pp-integral.exp index 8111d75fbfc..45645f9411c 100644 --- a/gdb/testsuite/gdb.python/py-pp-integral.exp +++ b/gdb/testsuite/gdb.python/py-pp-integral.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp index c87f30da975..bd26b91b7b6 100644 --- a/gdb/testsuite/gdb.python/py-pp-maint.exp +++ b/gdb/testsuite/gdb.python/py-pp-maint.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.exp b/gdb/testsuite/gdb.python/py-pp-re-notag.exp index 8111d75fbfc..45645f9411c 100644 --- a/gdb/testsuite/gdb.python/py-pp-re-notag.exp +++ b/gdb/testsuite/gdb.python/py-pp-re-notag.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp index c5e7f9aeb58..d0d1fda8d53 100644 --- a/gdb/testsuite/gdb.python/py-pp-registration.exp +++ b/gdb/testsuite/gdb.python/py-pp-registration.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index c342d453a9a..be2cecdab67 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -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 diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp index 1d271d4e89a..822c079682b 100644 --- a/gdb/testsuite/gdb.python/py-progspace.exp +++ b/gdb/testsuite/gdb.python/py-progspace.exp @@ -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" } diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.exp b/gdb/testsuite/gdb.python/py-read-memory-leak.exp index 9ae5eb8a5eb..0b663d72cda 100644 --- a/gdb/testsuite/gdb.python/py-read-memory-leak.exp +++ b/gdb/testsuite/gdb.python/py-read-memory-leak.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.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp index aff7c6c7403..6dd3ae17239 100644 --- a/gdb/testsuite/gdb.python/py-record-btrace.exp +++ b/gdb/testsuite/gdb.python/py-record-btrace.exp @@ -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 diff --git a/gdb/testsuite/gdb.python/py-record-full.exp b/gdb/testsuite/gdb.python/py-record-full.exp index 97d21ce97b3..790e5b33f5f 100644 --- a/gdb/testsuite/gdb.python/py-record-full.exp +++ b/gdb/testsuite/gdb.python/py-record-full.exp @@ -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 diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp index cc4425cf040..9d4e48c0cf7 100644 --- a/gdb/testsuite/gdb.python/py-section-script.exp +++ b/gdb/testsuite/gdb.python/py-section-script.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp index 5d7935629a5..e030768a16a 100644 --- a/gdb/testsuite/gdb.python/py-source-styling.exp +++ b/gdb/testsuite/gdb.python/py-source-styling.exp @@ -75,7 +75,7 @@ proc test_pygments_styling {} { return } - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.python/py-strfns.exp b/gdb/testsuite/gdb.python/py-strfns.exp index 2b5dff19d05..13b8d2e2650 100644 --- a/gdb/testsuite/gdb.python/py-strfns.exp +++ b/gdb/testsuite/gdb.python/py-strfns.exp @@ -26,7 +26,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.python/py-thread-exited.exp b/gdb/testsuite/gdb.python/py-thread-exited.exp index dcacb114032..0f47ce00745 100644 --- a/gdb/testsuite/gdb.python/py-thread-exited.exp +++ b/gdb/testsuite/gdb.python/py-thread-exited.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 5472482717d..c32a5bdf947 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp index 3d371bc07e2..6d261fb3520 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index b4e80a21135..087c8c2c5bd 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -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" diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp index 3dafe0e3093..5863ec59ef0 100644 --- a/gdb/testsuite/gdb.python/py-xmethods.exp +++ b/gdb/testsuite/gdb.python/py-xmethods.exp @@ -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 } diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 96977dff629..020fc66488a 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -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" }