diff options
Diffstat (limited to 'gdb/testsuite/gdb.mi')
101 files changed, 507 insertions, 309 deletions
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp index 3fd9b81..074defa 100644 --- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp +++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp @@ -42,11 +42,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != "" return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } -if [mi_runto func_nofb_marker] { +if {[mi_runto func_nofb_marker]} { # First try referencing DW_AT_frame_base which is not defined. mi_gdb_test "300-stack-list-locals --thread 1 --frame 1 --all-values" \ "300\\^done,locals=\\\[\{name=\"func_nofb_var\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\},\{name=\"func_nofb_var2\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\}\\\].*" \ @@ -54,13 +54,13 @@ if [mi_runto func_nofb_marker] { } # GDB could have crashed. -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } # And now try referencing DW_AT_frame_base defined using a self-reference # (DW_OP_fbreg). -if [mi_runto func_loopfb_marker] { +if {[mi_runto func_loopfb_marker]} { mi_gdb_test "301-stack-list-locals --thread 1 --frame 1 --all-values" \ "301\\^done,locals=\\\[\{name=\"func_loopfb_var\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\},\{name=\"func_loopfb_var2\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\}\\\]" \ "test func_loopfb_var" diff --git a/gdb/testsuite/gdb.mi/gdb2549.exp b/gdb/testsuite/gdb.mi/gdb2549.exp index 796c1fa..5aabc3b 100644 --- a/gdb/testsuite/gdb.mi/gdb2549.exp +++ b/gdb/testsuite/gdb.mi/gdb2549.exp @@ -94,7 +94,7 @@ proc register_tests { } { register_test 666 t $binary } -mi_clean_restart $binfile +mi_clean_restart $::testfile register_tests_no_exec diff --git a/gdb/testsuite/gdb.mi/gdb669.exp b/gdb/testsuite/gdb.mi/gdb669.exp index 086d3c1..da1db64 100644 --- a/gdb/testsuite/gdb.mi/gdb669.exp +++ b/gdb/testsuite/gdb.mi/gdb669.exp @@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main check_mi_and_console_threads "at main" diff --git a/gdb/testsuite/gdb.mi/gdb680.exp b/gdb/testsuite/gdb.mi/gdb680.exp index 6eb8928..bffdfa1 100644 --- a/gdb/testsuite/gdb.mi/gdb680.exp +++ b/gdb/testsuite/gdb.mi/gdb680.exp @@ -30,7 +30,7 @@ proc do_test {count} { "-data-list-register-names -1, try $count" } -# Tests a bug with ui-out and nested uiout types. When +# Tests a bug with ui-out and nested uiout types. When # an error is encountered building a nest typed, like # lists or tuples, the uiout is not reset to some sane # state. As a result, uiout still thinks it is building diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp index 587481c..9ef6fb7 100644 --- a/gdb/testsuite/gdb.mi/gdb701.exp +++ b/gdb/testsuite/gdb.mi/gdb701.exp @@ -35,7 +35,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} { # If it doesn't, Bad Things Happen(TM). # Run to main -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main # Step over "foo = 0" diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp index f894eea..a2d17aa 100644 --- a/gdb/testsuite/gdb.mi/gdb792.exp +++ b/gdb/testsuite/gdb.mi/gdb792.exp @@ -28,7 +28,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != "" return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main @@ -36,7 +36,7 @@ mi_create_varobj "var1" "a" "create var for class A" mi_list_varobj_children "var1" { {var1.public public 2} - {var1.private private 2} + {var1.private private 2} {var1.protected protected 2} } "list children of class A" diff --git a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp index ff35109..5f9e49e 100644 --- a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp +++ b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp @@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \ save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\" -ex \"set mi-async\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_detect_async @@ -54,7 +54,7 @@ mi_send_resuming_command "exec-continue --thread-group i1" \ # We can't run a second inferior on stub targets. We can still test with one # inferior and ensure that the command has the desired effect. -set use_second_inferior [expr {![use_gdb_stub]}] +set use_second_inferior [expr {![use_gdb_stub] && [allow_multi_inferior_tests]}] if { $use_second_inferior } { mi_gdb_test "-add-inferior" \ diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp index b41c768..b68cca6 100644 --- a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp +++ b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if [mi_gdb_start] { +if {[mi_gdb_start]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-add-inferior.exp b/gdb/testsuite/gdb.mi/mi-add-inferior.exp index d110e68..d7c959a 100644 --- a/gdb/testsuite/gdb.mi/mi-add-inferior.exp +++ b/gdb/testsuite/gdb.mi/mi-add-inferior.exp @@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ return -1 } -mi_clean_restart ${binfile} +mi_clean_restart ${::testfile} # Start execution to establish a connection. mi_runto_main @@ -73,14 +73,31 @@ set inf_line [string range "${inf_line}" $idx end] regexp "^(${decimal} \\(\[^)\]+\\))" $inf_line conn_info set conn_pattern [string_to_regexp "${conn_info}"] +# When using the 'remote' protocol, the connection cannot be shared +# between the original inferior, and the inferior created by +# 'add-inferior'. Remember, the 'remote' protocol doesn't allow new +# inferiors to be started. As a result, some of GDB's output will +# change. +set is_remote_conn [string equal [target_info gdb_protocol] "remote"] + # Now add a new inferior, this should use the connection of the # current inferior. -mi_gdb_test "-add-inferior" \ - [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ - "~\"\\\[New inferior 2\\\]\\\\n\"" \ - "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \ - "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \ - "mi add inferior" +if { $is_remote_conn } { + mi_gdb_test "-add-inferior" \ + [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ + "~\"\\\[New inferior 2\\\]\\\\n\"" \ + "&\"warning: can't share connection 1 \\(remote \[^\r\n\]+\\) between inferiors\\\\n\"" \ + "\~\"Added inferior 2\\\\n\"" \ + "\\^done,inferior=\"\[^\"\]+\"" ] \ + "mi add inferior" +} else { + mi_gdb_test "-add-inferior" \ + [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ + "~\"\\\[New inferior 2\\\]\\\\n\"" \ + "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \ + "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \ + "mi add inferior" +} # Now run 'info inferiors' again to check that the currently selected # inferior has not changed. @@ -107,7 +124,16 @@ gdb_test_multiple "info inferiors" \ } -re "^~\"\\s+2\\s+\[^\r\n\]+\\s+${conn_pattern}\\s+\[^\r\n\]+\r\n" { - set saw_new_inferior true + if { ! $is_remote_conn } { + set saw_new_inferior true + } + exp_continue + } + + -re "^~\"\\s+2\\s+<null>\\s*\[^\r\n\]+\r\n" { + if { $is_remote_conn } { + set saw_new_inferior true + } exp_continue } diff --git a/gdb/testsuite/gdb.mi/mi-async-run.exp b/gdb/testsuite/gdb.mi/mi-async-run.exp index 8352803..3df8769 100644 --- a/gdb/testsuite/gdb.mi/mi-async-run.exp +++ b/gdb/testsuite/gdb.mi/mi-async-run.exp @@ -35,7 +35,7 @@ proc test_async_run {} { set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""] - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp index 09db7f9..11ba52f 100644 --- a/gdb/testsuite/gdb.mi/mi-async.exp +++ b/gdb/testsuite/gdb.mi/mi-async.exp @@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb save_vars { GDBFLAGS } { set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""] - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } } @@ -55,8 +55,8 @@ proc linux_async_tests {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set line_main_next [expr $line_main_head + 3] + set line_main_body [expr {$line_main_head + 2}] + set line_main_next [expr {$line_main_head + 3}] mi_send_resuming_command_raw "start" "start: send" mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop" diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp index 2add9db..3038a2c 100644 --- a/gdb/testsuite/gdb.mi/mi-basics.exp +++ b/gdb/testsuite/gdb.mi/mi-basics.exp @@ -45,7 +45,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb # procedures work, so it makes no sense using them here. gdb_exit -if [mi_gdb_start separate-inferior-tty] { +if {[mi_gdb_start separate-inferior-tty]} { return } @@ -61,9 +61,9 @@ proc test_mi_interpreter_selection {} { # All this test expects is to get the prompt back # with no syntax error message - if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] { + if {![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"]} { return 1 - } + } note "Skipping all other MI tests." return 0 @@ -73,7 +73,7 @@ proc test_exec_and_symbol_mi_operatons {} { global mi_gdb_prompt global binfile testfile - if [is_remote host] { + if {[is_remote host]} { set filename ${testfile} remote_download host ${binfile} ${filename} } else { @@ -84,8 +84,8 @@ proc test_exec_and_symbol_mi_operatons {} { # Tests: # -file-exec-and-symbols - if [mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \ - "file-exec-and-symbols operation"] { + if {[mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \ + "file-exec-and-symbols operation"]} { note "Skipping all other MI tests." return 0 } @@ -144,7 +144,7 @@ proc test_dir_specification {} { # Add to the search directories, display, then reset back to default # Tests: # -environment-directory arg - # -environment-directory + # -environment-directory # -environment-directory -r mi_gdb_test "202-environment-directory ${testsubdir}" \ @@ -176,7 +176,7 @@ proc test_cwd_specification {} { # The canonical name of the working directory may differ on a # remote host from that on the build system. - if ![is_remote host] { + if {![is_remote host]} { mi_gdb_test "206-environment-pwd" \ "206\\\^done,cwd=\"${escapedobjdir}\"" \ "environment-pwd operation" @@ -192,9 +192,9 @@ proc test_path_specification {} { global envirodir global expect_out - # Add to the path, display, then reset + # Add to the path, display, then reset # Tests: - # -environment-path + # -environment-path # -environment-path dir1 dir2 # -environment-path -r dir # -environment-path -r @@ -220,7 +220,7 @@ proc test_path_specification {} { "210\\\^done,path=\"$orig_path\"" \ "environment-path -r operation" -} +} proc test_setshow_inferior_tty {} { global mi_gdb_prompt diff --git a/gdb/testsuite/gdb.mi/mi-break-qualified.exp b/gdb/testsuite/gdb.mi/mi-break-qualified.exp index b5e5e78..9adc2d9 100644 --- a/gdb/testsuite/gdb.mi/mi-break-qualified.exp +++ b/gdb/testsuite/gdb.mi/mi-break-qualified.exp @@ -93,7 +93,7 @@ proc test_break_qualified {} { "delete temp breakpoints" } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index bb982c3..2064efe 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -32,17 +32,17 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb # Locate line numbers in basics.c. set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] +set line_callee3_body [expr {$line_callee3_head + 2}] set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] +set line_callee2_body [expr {$line_callee2_head + 2}] set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] +set line_callee1_body [expr {$line_callee1_head + 2}] set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_callme_head [gdb_get_line_number "callme ("] -set line_callme_body [expr $line_callme_head + 2] +set line_callme_body [expr {$line_callme_head + 2}] set fullname "fullname=\"${fullname_syntax}${srcfile}\"" @@ -346,7 +346,7 @@ proc_with_prefix test_forced_conditions {} { set loc [mi_make_breakpoint_loc -enabled "N"] set args [list -cond "bad" -locations "\\\[$loc\\\]"] - set bp [eval mi_make_breakpoint_multi $args] + set bp [mi_make_breakpoint_multi {*}$args] mi_gdb_test "-break-insert -c bad --force-condition callme" \ "${warning}\\^done,$bp" \ @@ -362,7 +362,7 @@ proc_with_prefix test_forced_conditions {} { "${warning}\\^done" \ "invalid condition is forced" set args [list -cond "bad == 42" -locations "\\\[$loc\\\]"] - set bp [eval mi_make_breakpoint_multi $args] + set bp [mi_make_breakpoint_multi {*}$args] mi_gdb_test "-break-info 16" \ "\\^done,[mi_make_breakpoint_table [list $bp]]" \ "invalid condition is defined" @@ -398,7 +398,7 @@ proc test_break {mi_mode} { } else { set start_ops "" } - if [mi_clean_restart $binfile $start_ops ] { + if {[mi_clean_restart $::testfile $start_ops ]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp index 9cb91de..46561e4 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp @@ -48,7 +48,7 @@ proc test_insert_delete_modify { } { global lib_sl1 lib_sl2 global binfile - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_load_shlibs $lib_sl1 $lib_sl2 @@ -184,7 +184,7 @@ proc test_pending_resolved { } { global lib_sl1 lib_sl2 global mi_gdb_prompt - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } mi_load_shlibs $lib_sl1 $lib_sl2 @@ -279,7 +279,7 @@ proc test_auto_disable { } { global lib_sl1 lib_sl2 global binfile - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_load_shlibs $lib_sl1 $lib_sl2 diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp index cbf9f57..fe50cdc 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp @@ -34,7 +34,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug c++}] != proc make_breakpoints_pattern { expect_fixed_output bp_num loc1_en loc2_en } { - if $expect_fixed_output { + if {$expect_fixed_output} { return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*,locations=\\\[\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}\\\]\}" } else { return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*\},\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}" @@ -56,11 +56,11 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } { global MIFLAGS decimal binfile set MIFLAGS "-i=mi${mi_version}" - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_runto_main - if $use_fix_flag { + if {$use_fix_flag} { mi_gdb_test "-fix-multi-location-breakpoint-output" "\\^done" \ "send -fix-multi-location-breakpoint-output" } diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp index af514e8..e4242a3 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp @@ -30,7 +30,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } # script field, else expect it to output the broken pre-mi4 format. proc make_pattern { expect_fixed_output } { - if $expect_fixed_output { + if {$expect_fixed_output} { return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\[\"abc\",\"def\"\\\],.*" } else { return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\{\"abc\",\"def\"\\\},.*" @@ -51,10 +51,10 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } { save_vars { ::MIFLAGS } { set ::MIFLAGS "-i=mi${mi_version}" - mi_clean_restart $::binfile + mi_clean_restart $::testfile } - if $use_fix_flag { + if {$use_fix_flag} { mi_gdb_test "-fix-breakpoint-script-output" "\\^done" \ "send -fix-multi-location-breakpoint-output" } diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp index 9053b18..802d0be 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp @@ -27,11 +27,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile if {[mi_runto_main] < 0} { return -1 } -set libstdcxx_probe_tests_supported [expr ![mi_skip_libstdcxx_probe_tests]] +set libstdcxx_probe_tests_supported [expr {![mi_skip_libstdcxx_probe_tests]}] # Grab some line numbers we'll need. set catch_1_lineno [gdb_get_line_number "Catch 1"] @@ -46,7 +46,7 @@ proc restart_for_test {} { global srcdir subdir binfile srcfile global main_lineno - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp index a9a5fdc..3c36cc9 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-load.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp @@ -36,7 +36,7 @@ gdb_download_shlib $binfile2 # test -catch-load with_test_prefix "catch-load" { - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_locate_shlib $binfile2 mi_runto_main @@ -63,7 +63,7 @@ with_test_prefix "catch-load" { # test -catch-unload with_test_prefix "catch-unload" { - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_locate_shlib $binfile2 mi_runto_main diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp index a3ff7eb..7763689 100644 --- a/gdb/testsuite/gdb.mi/mi-cli.exp +++ b/gdb/testsuite/gdb.mi/mi-cli.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_gdb_test "-interpreter-exec" \ {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ @@ -59,14 +59,14 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ mi_runto_main set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] -set line_main_return [expr $line_main_hello + 2] -set line_main_callme_2 [expr $line_main_return + 1] +set line_main_return [expr {$line_main_hello + 2}] +set line_main_callme_2 [expr {$line_main_return + 1}] set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee4_next [expr $line_callee4_body + 1] -set line_callee4_next_step [expr $line_callee4_next + 3] +set line_callee4_body [expr {$line_callee4_head + 2}] +set line_callee4_next [expr {$line_callee4_body + 1}] +set line_callee4_next_step [expr {$line_callee4_next + 3}] mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ @@ -233,7 +233,7 @@ mi_gdb_test "-interpreter-exec console \"set listsize 10\"" \ "-interpreter-exec console \"set listsize 10\"" # "list" should show 10 lines centered on where the program stopped. -set first_list_line [expr $line_main_callme_2 - 5] +set first_list_line [expr {$line_main_callme_2 - 5}] mi_gdb_test "-interpreter-exec console \"list\"" \ ".*\~\"$first_list_line.*\\^done" \ "-interpreter-exec console \"list\" at basics.c:\$line_main_callme_2" diff --git a/gdb/testsuite/gdb.mi/mi-cmd-error.exp b/gdb/testsuite/gdb.mi/mi-cmd-error.exp index 195bced..81b3a23 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-error.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-error.exp @@ -70,7 +70,9 @@ set cmdnames { for {set i 0} {$i < [llength $procs]} {incr i} { for {set j 0} {$j < [llength $procs]} {incr j} { with_test_prefix "[lindex $cmdnames $i] first ($i x $j)" { + # tclint-disable-next-line command-args with_test_prefix "1st" [lindex $procs $i] + # tclint-disable-next-line command-args with_test_prefix "2nd" [lindex $procs $j] } } diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp index 5587b76..24d12c1 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp @@ -31,7 +31,7 @@ proc test_command_param_changed { } { global binfile with_test_prefix "cmd param" { - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_runto_main if { $scheduler_locking_supported } { diff --git a/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp index 806ed4c..324de5a 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp @@ -29,7 +29,7 @@ set main_break_line [gdb_get_line_number "main break line"] set any "\[^\r\n\]*" -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_create_breakpoint "$srcfile:$main_break_line" "set breakpoint in main" mi_run_cmd mi_expect_stop "breakpoint-hit" "main" "" $srcfile $main_break_line \ diff --git a/gdb/testsuite/gdb.mi/mi-complete.exp b/gdb/testsuite/gdb.mi/mi-complete.exp index 22acda3..ad29b3f 100644 --- a/gdb/testsuite/gdb.mi/mi-complete.exp +++ b/gdb/testsuite/gdb.mi/mi-complete.exp @@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile # Don't run to main to avoid increasing the search scope to include # debug info of shared libraries like glibc, libgcc, etc. diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp index 02d02b2..7708a6d 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp @@ -59,7 +59,7 @@ proc test { variant } { return -1 } - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp index 43b1e2f..34e9494 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp @@ -22,7 +22,7 @@ set MIFLAGS "-i=mi" standard_testfile -if [build_executable ${testfile}.exp ${binfile} ${srcfile}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} { return -1 } @@ -35,7 +35,7 @@ if [build_executable ${testfile}.exp ${binfile} ${srcfile}] { proc run_test { unwind_on_signal } { - if {[mi_clean_restart $::binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp index 9897b2b..1b4f817 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp @@ -16,7 +16,7 @@ # Check that when GDB fails to evaluate the condition of a conditional # breakpoint we only get one *stopped notification. In this test case # the breakpoint condition fails due to throwing an uncaught C++ -# excpetion. +# exception. require allow_cplus_tests @@ -25,7 +25,7 @@ set MIFLAGS "-i=mi" standard_testfile .cc -if [build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}]} { return -1 } @@ -38,7 +38,7 @@ if [build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}] { proc run_test { unwind_on_exception } { - if {[mi_clean_restart $::binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp index efb1ea9..710c2c8 100644 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ b/gdb/testsuite/gdb.mi/mi-console.exp @@ -53,7 +53,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -91,5 +91,5 @@ mi_gdb_test "220-exec-next" \ set line [gdb_get_line_number "after-hello"] mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" $line "" \ "finished step over hello" - + mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi-corefile.exp b/gdb/testsuite/gdb.mi/mi-corefile.exp index 3f0e720..d663eec 100644 --- a/gdb/testsuite/gdb.mi/mi-corefile.exp +++ b/gdb/testsuite/gdb.mi/mi-corefile.exp @@ -29,10 +29,11 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { set corefile [core_find $binfile {}] if {$corefile == ""} { + untested "unable to create or find corefile" return 0 } -if [mi_gdb_start] { +if {[mi_gdb_start]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-detach.exp b/gdb/testsuite/gdb.mi/mi-detach.exp index ff983c1..b485a9b 100644 --- a/gdb/testsuite/gdb.mi/mi-detach.exp +++ b/gdb/testsuite/gdb.mi/mi-detach.exp @@ -25,7 +25,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} { return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main mi_gdb_test "-target-detach" "=thread-exited,id=\"1\".*=thread-group-exited,id=\"i1\".*" "detach" diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp index 15ead33..6c6d05d 100644 --- a/gdb/testsuite/gdb.mi/mi-disassemble.exp +++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp @@ -36,7 +36,7 @@ proc test_disassembly_only {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -76,7 +76,7 @@ proc test_disassembly_with_opcodes {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly with opcodes for the current function. # Tests: @@ -106,7 +106,7 @@ proc test_disassembly_lines_limit {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -136,7 +136,7 @@ proc test_disassembly_mixed {} { global fullname_syntax set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] + set line_callee2_open_brace [expr {$line_callee2_head + 1}] # Test disassembly more only for the current function. # Tests: @@ -164,7 +164,7 @@ proc test_disassembly_mixed_with_opcodes {} { global fullname_syntax set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] + set line_callee2_open_brace [expr {$line_callee2_head + 1}] # Test disassembly mixed with opcodes for the current function. # Tests: @@ -192,8 +192,8 @@ proc test_disassembly_mixed_lines_limit {} { global fullname_syntax set line_main_head [gdb_get_line_number "main ("] - set line_main_open_brace [expr $line_main_head + 1] - set line_main_body [expr $line_main_head + 2] + set line_main_open_brace [expr {$line_main_head + 1}] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -220,7 +220,7 @@ proc test_disassembly_bogus_args {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test that bogus input to disassembly command is rejected. # Tests: @@ -321,7 +321,7 @@ proc test_disassembly_opcode_format {} { # Load the actual byte value from memory, and check it matches # the opcode byte reported in the disassembler output. - set addr 0x[format %x [expr $longest_insn_addr + $idx]] + set addr 0x[format %x [expr {$longest_insn_addr + $idx}]] set actual [format %02x [mi_get_valueof "/x" "*((unsigned char *) $addr)" "XX"]] gdb_assert [string equal $actual "$b"] \ "byte at $addr matches" @@ -335,7 +335,7 @@ proc test_disassembly_opcode_format {} { # Figure out an end address at which to stop the disassembly. set byte_count [llength $split_bytes] - set end_addr 0x[format %x [expr $longest_insn_addr + $byte_count]] + set end_addr 0x[format %x [expr {$longest_insn_addr + $byte_count}]] set start_addr $longest_insn_addr verbose -log "Instruction is ${byte_count} bytes, end address ${end_addr}" @@ -345,7 +345,7 @@ proc test_disassembly_opcode_format {} { "data-disassemble checking the opcodes bytes format" } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main test_disassembly_only test_disassembly_with_opcodes diff --git a/gdb/testsuite/gdb.mi/mi-dlmopen.exp b/gdb/testsuite/gdb.mi/mi-dlmopen.exp index c0208eb..0e1d0bc 100644 --- a/gdb/testsuite/gdb.mi/mi-dlmopen.exp +++ b/gdb/testsuite/gdb.mi/mi-dlmopen.exp @@ -65,9 +65,19 @@ if { $dyln_name eq "" } { set bp_main [gdb_get_line_number "bp.main" $srcfile] set bp_loaded [gdb_get_line_number "bp.loaded" $srcfile] +# If the dynamic linker path contains a symlink, some instances show the real +# path instead of the original path. Accept both. +lassign [remote_exec target realpath "$dyln_name"] realpath_ret dyln_realpath_name + +if { $realpath_ret == 0 } { + set dyln_realpath_name [string trim $dyln_realpath_name] +} else { + set dyln_realpath_name "not-a-valid-path" +} + # Return true if FILENAME is the dynamic linker. Otherwise return false. proc is_dyln { filename } { - return [expr {$filename eq $::dyln_name}] + return [expr {$filename eq $::dyln_name || $filename eq $::dyln_realpath_name}] } # Run 'info sharedlibrary' and count the number of mappings that look @@ -81,7 +91,7 @@ proc get_dyld_info {} { set dyld_count 0 set dyld_start_addr "" gdb_test_multiple "info sharedlibrary" "" { - -re "~\"From\\s+To(\\s+NS)?\\s+Syms\\s+Read\\s+Shared Object Library\\\\n\"\r\n" { + -re "~\"From\\s+To(\\s+Linker NS)?\\s+Syms\\s+Read\\s+Shared Object Library\\\\n\"\r\n" { exp_continue } -re "^~\"($::hex)\\s+${::hex}(\\s+$::decimal)?\\s+\[^/\]+(/\[^\r\n\]+)\\\\n\"\r\n" { @@ -122,7 +132,7 @@ proc get_dyld_info {} { # number of unload events for the libraries created for this test, and # additionally, check for dynamic linker unload events. proc check_solib_unload_events {} { - mi_clean_restart $::binfile + mi_clean_restart $::testfile if {[mi_runto_main] == -1} { return diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp index c3e1bdf..0584a86 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp @@ -52,7 +52,7 @@ if { [build_executable "build exec" $binfile $srcfile $opts] == -1} { set bp_line [gdb_get_line_number "Break here" $srcfile] # Start the inferior. -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main # Place a breakpoint at the dlopen() line. diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp index 2df9ad4..3685e42 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp @@ -39,7 +39,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp index 5d448e4..5d2d508 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -31,7 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile $flags] == -1} { set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] set dp_location1 [gdb_get_line_number "set dprintf 1 here"] -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main set i 0 @@ -129,7 +129,7 @@ mi_continue_dprintf "gdb" # The "call" style depends on having I/O functions available, so test. set has_stderr_symbol [mi_gdb_is_stderr_available] -if ![target_info exists gdb,noinferiorio] { +if {![target_info exists gdb,noinferiorio]} { # Now switch styles and rerun; in the absence of redirection the # output should be the same. @@ -165,7 +165,7 @@ gdb_expect { } } -if $target_can_dprintf { +if {$target_can_dprintf} { if {[mi_run_cmd] < 0} { # This likely means we failed to use target side commands in # combination with software breakpoints. IOW, the target @@ -174,7 +174,7 @@ if $target_can_dprintf { unsupported "send dprintf to target" } - if $target_can_dprintf { + if {$target_can_dprintf} { mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp index 27c27f5..eafdf69 100644 --- a/gdb/testsuite/gdb.mi/mi-eval.exp +++ b/gdb/testsuite/gdb.mi/mi-eval.exp @@ -32,15 +32,15 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] mi_runto callee4 -mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4" +mi_next_to "callee4" "" "basics.c" [expr {$line_callee4_body + 1}] "next at callee4" mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi-exec-run.exp index a7a61b8..04283a1 100644 --- a/gdb/testsuite/gdb.mi/mi-exec-run.exp +++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp @@ -30,6 +30,8 @@ set MIFLAGS "-i=mi" # cannot use it, then there is no point in running this testcase. require !use_gdb_stub +set have_startup_shell [have_startup_shell] + standard_testfile mi-start.c if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { @@ -57,7 +59,7 @@ proc test {inftty_mode mi_mode force_fail} { lappend start_ops "separate-mi-tty" } - if [mi_gdb_start $start_ops] { + if {[mi_gdb_start $start_ops]} { return } @@ -172,6 +174,9 @@ remote_exec target "chmod \"a-x\" $binfile.nox" foreach_with_prefix inferior-tty {"main" "separate"} { foreach_with_prefix mi {"main" "separate"} { foreach_with_prefix force-fail {0 1} { + if { ${force-fail} && $have_startup_shell == -1 } { + continue + } test ${inferior-tty} ${mi} ${force-fail} } } diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.exp b/gdb/testsuite/gdb.mi/mi-exit-code.exp index 344d565..af2c6bd 100644 --- a/gdb/testsuite/gdb.mi/mi-exit-code.exp +++ b/gdb/testsuite/gdb.mi/mi-exit-code.exp @@ -36,7 +36,7 @@ proc test_list_thread_groups { } { "122\\^done,groups=\\\[\{id=\"i1\",type=\"process\"\}\]" \ "-list-thread-groups before run shows no exit-code" - mi_clean_restart $binfile + mi_clean_restart $::testfile with_test_prefix "first run" { mi_runto_main diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp index 68c9e34..9b03936 100644 --- a/gdb/testsuite/gdb.mi/mi-file.exp +++ b/gdb/testsuite/gdb.mi/mi-file.exp @@ -44,7 +44,7 @@ proc test_file_list_exec_source_file {} { # get the path and absolute path to the current executable set line_main_head [gdb_get_line_number "main ("] - set line_main_prologue [expr $line_main_head + 1] + set line_main_prologue [expr {$line_main_head + 1}] set line_default $line_main_prologue mi_gdb_test "111-file-list-exec-source-file" \ diff --git a/gdb/testsuite/gdb.mi/mi-fill-memory.exp b/gdb/testsuite/gdb.mi/mi-fill-memory.exp index 0afc258..bf0bcb1 100644 --- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp +++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp @@ -21,13 +21,13 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" standard_testfile "mi-read-memory" - + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {debug}] != "" } { untested "failed to compile" return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp index 8886702..9b5d71a 100644 --- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp +++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp @@ -28,7 +28,7 @@ if {[build_executable "failed to prepare" ${testfile} \ return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main @@ -100,7 +100,7 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ { } else { fail $gdb_test_name } - } + } } mi_gdb_test "105-symbol-info-module-functions --name _all" \ @@ -161,5 +161,5 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ { } else { fail $gdb_test_name } - } + } } diff --git a/gdb/testsuite/gdb.mi/mi-frame-regs.exp b/gdb/testsuite/gdb.mi/mi-frame-regs.exp index f31e4a1..d34f244 100644 --- a/gdb/testsuite/gdb.mi/mi-frame-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-frame-regs.exp @@ -62,7 +62,7 @@ proc_with_prefix do_floating_varobj_test {} { global hex global expect_out - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { fail "couldn't start gdb" return } @@ -80,7 +80,7 @@ proc_with_prefix do_floating_varobj_test {} { # Run to a breakpoint in each callee function in succession. # Note that we can't use mi_runto because we need the # breakpoint to be persistent, so we can use its address. - set bpnum [expr $i + 1] + set bpnum [expr {$i + 1}] mi_create_breakpoint \ "basics.c:callee$i" \ "insert breakpoint at basics.c:callee$i" \ @@ -101,7 +101,7 @@ proc_with_prefix do_floating_varobj_test {} { if {$bpaddr == ""} { return } # Check that the addresses are the same. - gdb_assert [expr $bpaddr == $pcval] "\$pc equals address of breakpoint in callee$i" + gdb_assert [expr {$bpaddr == $pcval}] "\$pc equals address of breakpoint in callee$i" } } @@ -113,7 +113,7 @@ proc_with_prefix do_fixed_varobj_test {} { global srcfile binfile global hex - if {[mi_clean_restart $binfile] != 0} { + if {[mi_clean_restart $::testfile] != 0} { fail "couldn't start gdb" return } diff --git a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp index 130b5bf..6c1dbec 100644 --- a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp @@ -58,7 +58,7 @@ if { [gdb_compile "$srcfileabs" "${binfile}" executable {debug}] != "" } { file delete -- $srcfileabs -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp index 5d8d3ff..79307f3 100644 --- a/gdb/testsuite/gdb.mi/mi-info-os.exp +++ b/gdb/testsuite/gdb.mi/mi-info-os.exp @@ -27,12 +27,12 @@ require allow_xml_test standard_testfile basics.c -if [build_executable "Failed to build $testfile" $testfile $srcfile \ - debug] { +if {[build_executable "Failed to build $testfile" $testfile $srcfile \ + debug]} { return -1; } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp index f44fc29..80ca596 100644 --- a/gdb/testsuite/gdb.mi/mi-info-sources.exp +++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp @@ -26,7 +26,7 @@ if {[build_executable $testfile.exp $testfile \ return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile set readnow_p [mi_readnow] diff --git a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp index 0ab2de2..3092b692 100644 --- a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp +++ b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp @@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != "" return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp index 3314d5f..7eeb259 100644 --- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp +++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp @@ -29,7 +29,7 @@ if {[build_executable "failed to prepare" $exefile $srcfile {debug c++}]} { return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile # Turn off the pending breakpoint queries. mi_gdb_test "-interpreter-exec console \"set breakpoint pending off\"" \ diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp index de76e02..7fad225 100644 --- a/gdb/testsuite/gdb.mi/mi-logging.exp +++ b/gdb/testsuite/gdb.mi/mi-logging.exp @@ -19,12 +19,12 @@ set MIFLAGS "-i=mi" standard_testfile basics.c set opts {debug} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { untested "failed to compile" return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile if {[mi_runto_main] < 0} { return -1 @@ -51,7 +51,7 @@ close $chan set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" -if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { +if {[regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} { pass "log file contents" } else { fail "log file contents" @@ -74,7 +74,7 @@ set chan [open $milogfile] set logcontent [read $chan] close $chan -if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { +if {[regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} { pass "redirect log file contents" } else { fail "redirect log file contents" diff --git a/gdb/testsuite/gdb.mi/mi-memory-changed.exp b/gdb/testsuite/gdb.mi/mi-memory-changed.exp index bc2b6c3..6d02c33 100644 --- a/gdb/testsuite/gdb.mi/mi-memory-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-memory-changed.exp @@ -22,7 +22,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ load_lib mi-support.exp -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp index 20b8d46..052d600 100644 --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp @@ -38,7 +38,7 @@ proc run_test { args } { global mi_gdb_prompt global decimal - if [mi_clean_restart "" $args] { + if {[mi_clean_restart "" $args]} { return } @@ -90,7 +90,7 @@ proc run_test { args } { # looking for. However, due to the unpredictable # intermingling, it's much easier if we drop the ^ anchor. # However, with this gone dejagnu would sometimes match the - # second comand output before the first commands output. + # second command output before the first commands output. # # This approach just looks for the first command output, then, # once that has been found, we start looking for the second @@ -119,7 +119,7 @@ proc run_test { args } { # checking different command lengths. The actual bug this # test checks for would result in a timeout, so we don't want # to risk lots more timeouts. - if { ! [expr $seen_first_message && $seen_second_message ] } { + if { ! ($seen_first_message && $seen_second_message) } { break } } diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp index 599e460..4729033 100644 --- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp +++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp @@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp index b8efef7..07cf899 100644 --- a/gdb/testsuite/gdb.mi/mi-nonstop.exp +++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp @@ -41,7 +41,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" @@ -63,7 +63,7 @@ mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 1" mi_gdb_test "-thread-select 2" "\\^done.*" "select thread 2" mi_create_varobj I_W0 "i" "create varobj in first thread" mi_gdb_test "-thread-select 3" "\\^done.*" "select thread 3" -mi_create_varobj I_W1 "i" "create varobj in second thread" +mi_create_varobj I_W1 "i" "create varobj in second thread" mi_nonstop_resume "exec-continue --thread 2" "resume 1" mi_check_thread_states {"running" "running" "stopped"} "thread state, resume 1" @@ -95,7 +95,7 @@ mi_expect_stop "breakpoint-hit" "break_at_me" "\[^\n\]*" "non-stop.c" "\[0-9\]*" mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w1,i2 stop" # At this point, thread 1 (main) is running, and worker threads are stopped. -# Check that we can modify breakpoint condition, even when operating on a +# Check that we can modify breakpoint condition, even when operating on a # running thread. mi_gdb_test "-break-condition --thread 1 2 id==1" "\\^done" "set condition, 1" diff --git a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp index 20d9e45..20936f1 100644 --- a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp +++ b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp @@ -43,7 +43,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" \ save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-nsintrall.exp b/gdb/testsuite/gdb.mi/mi-nsintrall.exp index 983c0fe..8c8aef8 100644 --- a/gdb/testsuite/gdb.mi/mi-nsintrall.exp +++ b/gdb/testsuite/gdb.mi/mi-nsintrall.exp @@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp index da43a93..2307c2e 100644 --- a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp +++ b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp @@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp index fd8aa54..1f9d1ae 100644 --- a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp +++ b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp @@ -35,7 +35,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp index 49839cb..4231671 100644 --- a/gdb/testsuite/gdb.mi/mi-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-pending.exp @@ -45,7 +45,7 @@ if { [gdb_compile_pthreads $srcdir/$subdir/$srcfile $binfile executable $exec_op } # Start with a fresh gdb. -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } mi_load_shlibs $lib_sl1 @@ -105,7 +105,7 @@ mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \ mi_send_resuming_command "exec-continue" "continuing execution to skip conditional bp" -# We should not stop on the conditional breakpoint yet, but we stop on the original bp. +# We should not stop on the conditional breakpoint yet, but we stop on the original bp. mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \ { "" "disp=\"keep\"" } \ "Run till MI pending breakpoint on pendfunc1 a second time" diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp index 93f0344..13ea6ba 100644 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp @@ -28,7 +28,7 @@ proc check_mi_thread_command_set {} { mi_runto done_making_threads set thread_list [get_mi_thread_list "in check_mi_thread_command_set"] - + mi_gdb_test "-thread-select" \ {\^error,msg="-thread-select: USAGE: threadnum."} \ "check_mi_thread_command_set: -thread-select" @@ -63,7 +63,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp b/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp index 4193757..5175899 100644 --- a/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp +++ b/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp @@ -31,7 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} { set remote_python_file [gdb_remote_download host \ ${srcdir}/${subdir}/${testfile}.py] -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main # Delete all breakpoints, watchpoints, tracepoints, and catchpoints. diff --git a/gdb/testsuite/gdb.mi/mi-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp index 8de8728..4469123 100644 --- a/gdb/testsuite/gdb.mi/mi-read-memory.exp +++ b/gdb/testsuite/gdb.mi/mi-read-memory.exp @@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp index e37540b..986efd9 100644 --- a/gdb/testsuite/gdb.mi/mi-record-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp @@ -24,7 +24,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ load_lib mi-support.exp -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp index c7e0564..d3ca0bc 100644 --- a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp +++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp @@ -29,11 +29,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } -if ![mi_runto stop_frame] { +if {![mi_runto stop_frame]} { perror "Failed to stop in stop_frame" return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp index 0bb305b..aae00a6 100644 --- a/gdb/testsuite/gdb.mi/mi-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-regs.exp @@ -108,7 +108,7 @@ require {istarget "sparc-*-*"} mi_clean_restart sparc_register_tests_no_exec -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main sparc_register_tests diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp index ba296d5..665be99 100644 --- a/gdb/testsuite/gdb.mi/mi-return.exp +++ b/gdb/testsuite/gdb.mi/mi-return.exp @@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -40,8 +40,8 @@ proc test_return_simple {} { global hex fullname_syntax srcfile set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_call [expr {$line_callee3_head + 2}] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now" } diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp index d039240..5f6eb3f 100644 --- a/gdb/testsuite/gdb.mi/mi-reverse.exp +++ b/gdb/testsuite/gdb.mi/mi-reverse.exp @@ -39,14 +39,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main -if [supports_process_record] { +if {[supports_process_record]} { # Activate process record/replay - if [mi_gdb_test "-interpreter-exec console record" \ - "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \ - "Turn on process record"] { + if {[mi_gdb_test "-interpreter-exec console record" \ + "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \ + "Turn on process record"]} { warning "Fail to activate process record/replay, tests in this group will not be performed.\n" return -1 } @@ -54,20 +54,20 @@ if [supports_process_record] { # Locate line numbers in basics.c. set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] -set line_callee3_close [expr $line_callee3_head + 3] +set line_callee3_body [expr {$line_callee3_head + 2}] +set line_callee3_close [expr {$line_callee3_head + 3}] set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] -set line_callee2_close [expr $line_callee2_head + 3] +set line_callee2_body [expr {$line_callee2_head + 2}] +set line_callee2_close [expr {$line_callee2_head + 3}] set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] -set line_callee1_close [expr $line_callee1_head + 3] +set line_callee1_body [expr {$line_callee1_head + 2}] +set line_callee1_close [expr {$line_callee1_head + 3}] set line_callme_head [gdb_get_line_number "callme"] -set line_callme_body [expr $line_callme_head + 2] +set line_callme_body [expr {$line_callme_head + 2}] set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] set line_main_callme_1 [gdb_get_line_number "callme (1"] diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp index e390f14..b34097e 100644 --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp +++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp @@ -34,7 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -42,13 +42,13 @@ proc test_breakpoints_creation_and_listing {} { global srcfile set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_body [expr $line_callee3_head + 2] + set line_callee3_body [expr {$line_callee3_head + 2}] set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_body [expr $line_callee2_head + 2] + set line_callee2_body [expr {$line_callee2_head + 2}] set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert some breakpoints and list them # Also, disable some so they do not interfere with other tests @@ -96,7 +96,7 @@ proc test_breakpoints_creation_and_listing {} { proc test_running_the_program {} { set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Run the program without args, then specify srgs and rerun the program # Tests: @@ -115,14 +115,14 @@ proc test_controlled_execution {} { global hex set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_call [expr {$line_callee3_head + 2}] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] set line_callee1_head [gdb_get_line_number "callee1 ("] - set line_callee1_body [expr $line_callee1_head + 2] + set line_callee1_body [expr {$line_callee1_head + 2}] set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Continue execution until a breakpoint is reached, step into calls, verifying # if the arguments are correctly shown, continue to the end of a called @@ -133,7 +133,7 @@ proc test_controlled_execution {} { # -exec-step # -exec-finish - mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main" + mi_next_to "main" "" "basics.c" [expr {$line_main_body + 1}] "next at main" # FIXME: A string argument is not printed right; should be fixed and # we should look for the right thing here. diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp index c66d4b0..8ddca8d 100644 --- a/gdb/testsuite/gdb.mi/mi-solib.exp +++ b/gdb/testsuite/gdb.mi/mi-solib.exp @@ -34,7 +34,7 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index a91b76e..ebd685f 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -32,7 +32,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -87,7 +87,7 @@ proc test_stack_args_listing {} { # -stack-list-arguments 1 # -stack-list-arguments 1 1 1 # -stack-list-arguments 1 1 3 - # -stack-list-arguments + # -stack-list-arguments # -stack-list-arguments 1 1 300 # -stack-list-arguments 2 1 1 # -stack-list-arguments --simple-values 1 1 diff --git a/gdb/testsuite/gdb.mi/mi-start.exp b/gdb/testsuite/gdb.mi/mi-start.exp index 745e5c9..d384230 100644 --- a/gdb/testsuite/gdb.mi/mi-start.exp +++ b/gdb/testsuite/gdb.mi/mi-start.exp @@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp index 8ba6399..f2871dc 100644 --- a/gdb/testsuite/gdb.mi/mi-stepi.exp +++ b/gdb/testsuite/gdb.mi/mi-stepi.exp @@ -35,7 +35,7 @@ proc test_stepi_nexti {} { global hex fullname_syntax srcfile set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] set line [mi_execute_to "exec-step-instruction" "end-stepping-range" "main" "" \ @@ -44,7 +44,7 @@ proc test_stepi_nexti {} { pass "step-instruction at main, line check" } else { fail "step-instruction at main, line check" - } + } set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ ".*basics.c" "\[0-9\]+" "" "next-instruction at main"] @@ -63,7 +63,7 @@ proc test_stepi_nexti {} { } } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main test_stepi_nexti diff --git a/gdb/testsuite/gdb.mi/mi-stepn.exp b/gdb/testsuite/gdb.mi/mi-stepn.exp index 489564a..85b2092 100644 --- a/gdb/testsuite/gdb.mi/mi-stepn.exp +++ b/gdb/testsuite/gdb.mi/mi-stepn.exp @@ -22,11 +22,11 @@ set MIFLAGS "-i=mi" standard_testfile set opts {debug} -if [build_executable ${testfile}.exp ${testfile} ${srcfile} $opts] { +if {[build_executable ${testfile}.exp ${testfile} ${srcfile} $opts]} { return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile if {[mi_runto_main] < 0} { return -1 diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp index ef8dd86..6b0bf2d 100644 --- a/gdb/testsuite/gdb.mi/mi-sym-info.exp +++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp @@ -33,7 +33,7 @@ if {[build_executable "failed to prepare" ${testfile} \ return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile # Don't run to main to avoid increasing the search scope to include # debug info of shared libraries like libc, libgcc, etc. diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp index 633f317..11e208d 100644 --- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp +++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile mi_runto_main @@ -91,7 +91,7 @@ mi_gdb_test "409-stack-list-frames 0 0" \ # # Call bar() by hand, which should get an exception while running. -# +# mi_gdb_test "410-data-evaluate-expression bar()" \ ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwind-on-signal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ diff --git a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp index 2a734c8..e07767c 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp @@ -24,9 +24,9 @@ set MIFLAGS "-i=mi" # We need to do things a little differently when using the remote protocol. set is_remote \ - [expr [target_info exists gdb_protocol] \ - && ([string equal [target_info gdb_protocol] "remote"] \ - || [string equal [target_info gdb_protocol] "extended-remote"])] + [expr {[target_info exists gdb_protocol] \ + && ([string equal [target_info gdb_protocol] "remote"] \ + || [string equal [target_info gdb_protocol] "extended-remote"])}] standard_testfile @@ -47,7 +47,7 @@ foreach_mi_ui_mode mode { save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"maint set target-non-stop on\"" append GDBFLAGS " -ex \"set mi-async on\"" - mi_clean_restart $binfile $start_ops + mi_clean_restart $::testfile $start_ops } mi_runto_main diff --git a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp index 86d050a..c8543f4 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp @@ -25,7 +25,7 @@ if {[mi_clean_restart]} { standard_testfile -if [build_executable ${testfile}.exp ${binfile} ${srcfile}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} { return -1 } @@ -90,7 +90,7 @@ foreach_mi_ui_mode mode { set start_ops "" } - if {[mi_clean_restart $binfile $start_ops]} { + if {[mi_clean_restart $::testfile $start_ops]} { break } diff --git a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp index ff74e7b..8aab3b8 100644 --- a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp +++ b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp @@ -33,7 +33,7 @@ proc test_continue_interrupt { } { global binfile global async - if {[mi_clean_restart $binfile]} { + if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp index ee50c4f..b027c76 100644 --- a/gdb/testsuite/gdb.mi/mi-until.exp +++ b/gdb/testsuite/gdb.mi/mi-until.exp @@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -67,7 +67,7 @@ proc test_until {} { # after foo is over. set line [gdb_get_line_number "at-return"] mi_execute_to "exec-until until.c:$line" "location-reached" "main" ""\ - ".*until.c" "([expr $line-2]|[expr $line-1])" ""\ + ".*until.c" "([expr {$line-2}]|[expr {$line-1}])" ""\ "until after current function" } diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index bdba639..3914c3a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp index c424490..4856e3d 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp @@ -28,7 +28,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 89ce9dd..c69b72a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed" # Step over "struct_declarations.integer = 123;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" + [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \ # bar = 2121; # foo = &bar; mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" + [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -688,7 +688,7 @@ mi_varobj_update * {struct_declarations.char_ptr struct_declarations.char_ptr.\\ # Step over "struct_declarations.int_ptr_ptr = &foo;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" + [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -702,7 +702,7 @@ mi_varobj_update * {weird->int_ptr_ptr # Step over "weird->long_array[0] = 1234;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" + [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -711,7 +711,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \ # Step over "struct_declarations.long_array[1] = 2345;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" + [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -720,7 +720,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \ # Step over "weird->long_array[2] = 3456;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" + [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -754,7 +754,7 @@ mi_varobj_update * {struct_declarations.long_array.3 # Step over "weird->func_ptr = nothing"; mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1" + [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -763,19 +763,19 @@ mi_varobj_update * {struct_declarations.func_ptr} \ # Step over "weird->func_ptr_struct = nothing1" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2" + [expr {$line_dct_nothing + 2}] "step \$line_dct_nothing + 2" mi_varobj_update * {struct_declarations.func_ptr_struct} \ "update all vars struct_declarations.func_ptr_struct changed" # Step over "weird->func_ptr_ptr = nothing2" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 3] "step \$line_dct_nothing + 3" + [expr {$line_dct_nothing + 3}] "step \$line_dct_nothing + 3" mi_varobj_update * {struct_declarations.func_ptr_ptr} \ "update all vars struct_declarations.func_ptr_ptr changed" # Step over "struct_declarations.long_array[10] = 3456"; mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 4] "step \$line_dct_nothing + 4" + [expr {$line_dct_nothing + 4}] "step \$line_dct_nothing + 4" mi_gdb_test "-var-update --no-values *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ @@ -837,7 +837,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"] mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" + [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -987,7 +987,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \ # Test: c_variable-5.31 # Desc: children of psnp->ptrs -mi_list_varobj_children "psnp->ptrs" { +mi_list_varobj_children "psnp->ptrs" { {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}} {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}} {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}} @@ -1123,7 +1123,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" { # Step over "snp0.char_ptr = &b3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" + [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1136,7 +1136,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr # Step over "snp1.char_ptr = &c3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" + [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1150,7 +1150,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr # Step over "snp2.char_ptr = &a3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" + [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1160,7 +1160,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \ # Step over "snp0.long_ptr = &y3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" + [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1174,7 +1174,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr # Step over "snp1.long_ptr = &x3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" + [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1191,7 +1191,7 @@ clear_xfail *-*-* # Step over "snp2.long_ptr = &z3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" + [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 8c8c306..850cb99 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -150,7 +150,7 @@ mi_gdb_test "-var-update *" \ "update all vars: linteger changed" # Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests, 2" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 1}] "step at do_locals_tests, 2" # Test: c_variable-2.3 # Desc: check whether only lpinteger changed @@ -159,7 +159,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lpinteger changed" # Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests, 3" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 2}] "step at do_locals_tests, 3" # Test: c_variable-2.4 # Desc: check whether only lcharacter changed @@ -168,7 +168,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lcharacter changed" # Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests, 4" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 3}] "step at do_locals_tests, 4" # Test: c_variable-2.5 # Desc: check whether only lpcharacter changed @@ -189,7 +189,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'a'; mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests, 5" + "var-cmd.c" [expr {$line_dlt_linteger + 12}] "" "step at do_locals_tests, 5" # Test: c_variable-2.6 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, @@ -226,7 +226,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'b'; mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests, 7" + "var-cmd.c" [expr {$line_dlt_4321 + 8}] "" "step at do_locals_tests, 7" # Test: c_variable-2.8 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, @@ -238,7 +238,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lsimple and others changed" -### +### # # Test assignment to variables. More tests on assignment are in other files. # @@ -366,7 +366,7 @@ mi_gdb_test "-var-update *" \ # Check that assignment of function and array values # promotes the assigned value to function pointer/data -# pointer before comparing with the existing value, +# pointer before comparing with the existing value, # and does not incorrectly make the value as changed. mi_gdb_test "-var-assign func do_block_tests" \ "\\^done,value=\"$hex <do_block_tests>\"" \ @@ -398,7 +398,7 @@ mi_gdb_test "-var-update *" \ ###### -# End of assign tests +# End of assign tests ##### set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] @@ -418,7 +418,7 @@ mi_gdb_test "-var-create linteger * linteger" \ "create linteger" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" + "var-cmd.c" [expr {$line_subroutine1_body + 1}] "step at subroutine1" # Test: c_variable-2.12 # Desc: change global_simple.integer @@ -434,7 +434,7 @@ mi_gdb_test "-var-update *" \ clear_xfail *-*-* mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1, 2" + "var-cmd.c" [expr {$line_subroutine1_body + 2}] "step at subroutine1, 2" # Test: c_variable-2.13 # Desc: change subroutine1 local i @@ -443,7 +443,7 @@ mi_gdb_test "-var-update *" \ "update all vars: i changed" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1, 3" + "var-cmd.c" [expr {$line_subroutine1_body + 3}] "step at subroutine1, 3" # Test: c_variable-2.14 # Desc: change do_locals_tests local llong @@ -453,7 +453,7 @@ mi_gdb_test "-var-update *" \ set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] mi_next_to "do_locals_tests" "" "var-cmd.c" \ - [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" + [expr {$line_dlt_call_subroutine1 + 1}] "next out of subroutine1" # Test: c_variable-2.15 # Desc: check for out of scope subroutine1 locals @@ -560,7 +560,7 @@ mi_gdb_test "-var-update selected_a" \ "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ "update selected_a in do_special_tests" -if [is_remote host] { +if {[is_remote host]} { set filename ${testfile} } else { set filename ${binfile} diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp index c1d70f1..eee1007 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cp.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp @@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != "" return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp index ad6ce5c..371d430 100644 --- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp @@ -19,11 +19,11 @@ set MIFLAGS "-i=mi" standard_testfile .c set opts {debug} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { return -1 } -mi_clean_restart $binfile +mi_clean_restart $::testfile if {[mi_runto_main] < 0} { return -1 diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 61b3894..52a5276 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -96,7 +96,7 @@ mi_gdb_test "-var-evaluate-expression bar" \ # Desc: change value of bar mi_gdb_test "-var-assign bar 3" \ "\\^done,value=\"0x3\"" \ - "assing to variable bar" + "assign to variable bar" mi_gdb_test "-var-set-format bar decimal" \ "\\^done,format=\"decimal\",value=\"3\"" \ @@ -152,7 +152,7 @@ mi_gdb_test "-var-evaluate-expression foo" \ # Desc: change value of foo mi_gdb_test "-var-assign foo 3" \ "\\^done,value=\"03\"" \ - "assing to variable foo" + "assign to variable foo" mi_gdb_test "-var-set-format foo decimal" \ "\\^done,format=\"decimal\",value=\"3\"" \ @@ -624,8 +624,8 @@ mi_gdb_test "-var-list-children anone" \ # Record fp -if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { - set fp $expect_out(3,string) +if {![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"]} { + set fp $expect_out(3,string) } mi_continue_to "incr_a" diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp index c1c52f2..800c22f 100644 --- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp +++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp @@ -44,7 +44,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp index 0f20c50f..597e2e0 100644 --- a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp +++ b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp @@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp index fcf8404..2482df7 100644 --- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp @@ -21,11 +21,11 @@ set MIFLAGS "-i=mi" standard_testfile .cc set opts {debug c++} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-vla-c99.exp b/gdb/testsuite/gdb.mi/mi-vla-c99.exp index ec12e6f..5f23d05 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-c99.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-c99.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" \ return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp index 5077089..81e2d89 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp @@ -34,7 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ # the type names can be printed differently. set real [fortran_real4] -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp index f9237c0..36d7410 100644 --- a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp +++ b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp @@ -38,7 +38,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" - mi_clean_restart $binfile + mi_clean_restart $::testfile } mi_gdb_test "-gdb-set mi-async 1" ".*" diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp index e318a2b..1ddd94e 100644 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ b/gdb/testsuite/gdb.mi/mi-watch.exp @@ -44,7 +44,7 @@ proc test_watchpoint_creation_and_listing {} { global hex set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] # Insert a watchpoint and list # Tests: @@ -68,7 +68,7 @@ proc test_awatch_creation_and_listing {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert an access watchpoint and list it # Tests: @@ -95,7 +95,7 @@ proc test_rwatch_creation_and_listing {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert a read watchpoint and list it. # Tests: @@ -121,9 +121,9 @@ proc test_watchpoint_triggering {} { set line_callee4_return_0 [gdb_get_line_number "return 0;"] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] - # Continue execution until the watchpoint is reached, continue again, + # Continue execution until the watchpoint is reached, continue again, # to see the watchpoint go out of scope. # Does: # -exec-continue (Here wp triggers) @@ -155,7 +155,7 @@ proc test_watchpoint_all {mi_mode type} { } else { set start_ops "" } - if [mi_clean_restart ${binfile} $start_ops] { + if {[mi_clean_restart ${::testfile} $start_ops]} { return } diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp index c7e21e9..4b1d440 100644 --- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp +++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp @@ -19,7 +19,7 @@ set MIFLAGS "-i=mi2" standard_testfile .s set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.mi/mi2-amd64-entry-value.exp COMPILE=1" set srcfile ${testfile}.c lappend opts debug optimize=-O2 @@ -27,11 +27,11 @@ if [info exists COMPILE] { require is_x86_64_m64_target } -if [build_executable ${testfile}.exp ${binfile} ${srcfile} $opts] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile} $opts]} { return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi2-cli-display.exp b/gdb/testsuite/gdb.mi/mi2-cli-display.exp index 656c93e..993b87c 100644 --- a/gdb/testsuite/gdb.mi/mi2-cli-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-cli-display.exp @@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 9bd9054..4ee19f0 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if {[mi_clean_restart $binfile]} { +if {[mi_clean_restart $::testfile]} { return } @@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed" # Step over "struct_declarations.integer = 123;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" + [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \ # bar = 2121; # foo = &bar; mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" + [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -689,7 +689,7 @@ mi_varobj_update * {struct_declarations.char_ptr # Step over "struct_declarations.int_ptr_ptr = &foo;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" + [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -703,7 +703,7 @@ mi_varobj_update * {weird->int_ptr_ptr # Step over "weird->long_array[0] = 1234;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" + [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -712,7 +712,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \ # Step over "struct_declarations.long_array[1] = 2345;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" + [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -721,7 +721,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \ # Step over "weird->long_array[2] = 3456;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" + [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -755,7 +755,7 @@ mi_varobj_update * {struct_declarations.long_array.3 # Step over "weird->func_ptr = nothing;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1" + [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -777,7 +777,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"] mi_execute_to "exec-step 45" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" + [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -928,7 +928,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \ # Test: c_variable-5.31 # Desc: children of psnp->ptrs -mi_list_varobj_children "psnp->ptrs" { +mi_list_varobj_children "psnp->ptrs" { {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}} {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}} {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}} @@ -1065,7 +1065,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" { # Step over "snp0.char_ptr = &b3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" + [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1078,7 +1078,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr # Step over "snp1.char_ptr = &c3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" + [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1092,7 +1092,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr # Step over "snp2.char_ptr = &a3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" + [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1102,7 +1102,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \ # Step over "snp0.long_ptr = &y3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" + [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1116,7 +1116,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr # Step over "snp1.long_ptr = &x3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" + [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1133,7 +1133,7 @@ clear_xfail *-*-* # Step over "snp2.long_ptr = &z3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" + [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp index aa18668..b5b748e 100644 --- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp @@ -51,7 +51,7 @@ foreach_mi_ui_mode mode { set start_ops "" } - if [mi_gdb_start $start_ops] { + if {[mi_gdb_start $start_ops]} { return } diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp index cb83329..cda1e01 100644 --- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp @@ -69,7 +69,9 @@ proc do_test {sync_command} { # in the separate MI UI. Note the "run" variant usually triggers # =thread-group-started/=thread-created/=library-loaded as well. with_spawn_id $gdb_main_spawn_id { - gdb_test "add-inferior" "Added inferior 2 on connection .*" + # We don't need to share the connection with inferior 1 to + # trigger the async event. + gdb_test "add-inferior -no-connection" "Added inferior 2" } # Interrupt the program. @@ -102,7 +104,7 @@ proc do_test {sync_command} { } foreach_with_prefix sync-command {"run" "continue"} { - if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} { + if {[mi_clean_restart $::testfile "separate-mi-tty"] != 0} { fail "could not start gdb" break } diff --git a/gdb/testsuite/gdb.mi/pr11022.exp b/gdb/testsuite/gdb.mi/pr11022.exp index ad8e3b2..1e01bf6 100644 --- a/gdb/testsuite/gdb.mi/pr11022.exp +++ b/gdb/testsuite/gdb.mi/pr11022.exp @@ -29,7 +29,7 @@ proc test_memory_changed_observer { mi_command } { with_test_prefix "${mi_command}" { global srcfile binfile - mi_clean_restart $binfile + mi_clean_restart $::testfile mi_runto_main set line_number [gdb_get_line_number "break here"] diff --git a/gdb/testsuite/gdb.mi/print-simple-values.exp b/gdb/testsuite/gdb.mi/print-simple-values.exp index 1c56d68..023f87c 100644 --- a/gdb/testsuite/gdb.mi/print-simple-values.exp +++ b/gdb/testsuite/gdb.mi/print-simple-values.exp @@ -30,11 +30,11 @@ lappend opts debug lappend opts c++ lappend opts additional_flags=-std=c++11 -if [build_executable "failed to prepare" $testfile $srcfile $opts] { +if {[build_executable "failed to prepare" $testfile $srcfile $opts]} { return -1 } -if [mi_clean_restart $binfile] { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp index df370c9..c9e352d 100644 --- a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp +++ b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp @@ -29,7 +29,7 @@ if {[build_executable $testfile.exp $testfile ${srcfile} "debug"] == -1} { # UI_TO_RUN is the UI that should issue the run command. proc do_test { ui_to_run } { - if {[mi_clean_restart $::binfile "separate-mi-tty"] != 0} { + if {[mi_clean_restart $::testfile "separate-mi-tty"] != 0} { fail "could not start gdb" return } diff --git a/gdb/testsuite/gdb.mi/set-show.exp b/gdb/testsuite/gdb.mi/set-show.exp new file mode 100644 index 0000000..0c28a5f --- /dev/null +++ b/gdb/testsuite/gdb.mi/set-show.exp @@ -0,0 +1,51 @@ +# Copyright 2021 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 +# (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 <http://www.gnu.org/licenses/>. + +# Test the -gdb-set and -gdb-show commands. + +load_lib mi-support.exp +set MIFLAGS "-i=mi" + +standard_testfile + +# Some parameters are per inferior. The value returned by -gdb-show for them +# should be dependent on which is the current inferior. +proc_with_prefix test_per_inferior_parameters { } { + mi_clean_restart + + # Add a second inferior right away. + mi_gdb_test "-add-inferior" ".*\\^done,inferior=\"i2\"" "add inferior" + + # Set distinct values on each inferior. + foreach_with_prefix inf {1 2} { + mi_gdb_test "-gdb-set --thread-group i${inf} inferior-tty /inf${inf}-tty" "\\^done" "set inferior-tty" + mi_gdb_test "-gdb-set --thread-group i${inf} cwd /inf${inf}-cwd" "\\^done" "set cwd" + mi_gdb_test "-gdb-set --thread-group i${inf} args /inf${inf}-args" "\\^done" "set args" + mi_gdb_test "-gdb-set --thread-group i${inf} remote exec-file /inf${inf}-ref" "\\^done" "set remote exec-file" + # Outputs a warning, ignore it. + mi_gdb_test "-gdb-set --thread-group i${inf} tdesc filename /inf${inf}-tf" ".*\\^done" "set tdesc filename" + } + + # Check values on each inferior. + foreach_with_prefix inf {1 2} { + mi_gdb_test "-gdb-show --thread-group i${inf} inferior-tty" "\\^done,value=\"/inf${inf}-tty\"" "show inferior-tty" + mi_gdb_test "-gdb-show --thread-group i${inf} cwd" "\\^done,value=\"/inf${inf}-cwd\"" "show cwd" + mi_gdb_test "-gdb-show --thread-group i${inf} args" "\\^done,value=\"/inf${inf}-args\"" "show args" + mi_gdb_test "-gdb-show --thread-group i${inf} remote exec-file" "\\^done,value=\"/inf${inf}-ref\"" "show remote exec-file" + mi_gdb_test "-gdb-show --thread-group i${inf} tdesc filename" "\\^done,value=\"/inf${inf}-tf\"" "show tdesc filename" + } +} + +test_per_inferior_parameters diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index 9198cfb..8a4827f 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -40,6 +40,8 @@ standard_testfile # gdbserver modes are supported. require !use_gdb_stub +require allow_multi_inferior_tests + set compile_options "debug pthreads" if {[build_executable $testfile.exp $testfile ${srcfile} ${compile_options}] == -1} { untested "failed to compile" @@ -111,7 +113,7 @@ proc make_cli_re { mode inf thread frame } { } set thread_re $all_stop_thread_re - if [thread_is_running $mode $thread] { + if {[thread_is_running $mode $thread]} { set thread_re "$thread_re\\\(running\\\)" } @@ -574,10 +576,8 @@ proc_with_prefix test_cli_thread { mode } { match_re_or_ensure_no_output $mi_re "select thread, event on MI " } - # Do the 'thread' command to select the same thread. We shouldn't receive - # an event on MI, since we won't actually switch thread. - - set mi_re "" + # Do the 'thread' command to select the same thread. We + # should see the same thread events. with_spawn_id $gdb_main_spawn_id { gdb_test "thread 1.2" $cli_re "select thread again" @@ -587,6 +587,30 @@ proc_with_prefix test_cli_thread { mode } { match_re_or_ensure_no_output $mi_re "select thread, event on MI again" } + # Use the 'frame' command to select frame 1. In either mode + # the current thread is stopped, so this should work. + with_spawn_id $gdb_main_spawn_id { + gdb_test "frame 1" [make_cli_re $mode -1 -1 1] \ + "select frame 1" + } + + with_spawn_id $mi_spawn_id { + match_re_or_ensure_no_output [make_mi_re $mode 2 1 event] \ + "select frame 1, event on MI" + } + + # Reselect the current thread. GDB will switch back to + # frame #0, and send CLI and MI notifications. + with_spawn_id $gdb_main_spawn_id { + gdb_test "thread 1.2" $cli_re \ + "select thread again, resetting frame" + } + + with_spawn_id $mi_spawn_id { + match_re_or_ensure_no_output $mi_re \ + "select thread again, resetting frame, event on MI" + } + # Try the 'thread' command without arguments. set cli_re "\\\[Current thread is 1\\.2.*\\\]" @@ -621,10 +645,9 @@ proc_with_prefix test_cli_thread { mode } { match_re_or_ensure_no_output $mi_re "select thread, event on MI" } - # Do the 'thread' command to select the third thread again. Again, we - # shouldn't receive an event on MI. - - set mi_re "" + # Do the 'thread' command to select the third thread again. + # We should get the same thread events again as selecting the + # same thread still resets the frame to #0. with_spawn_id $gdb_main_spawn_id { gdb_test "thread 1.3" $cli_re "select thread again" @@ -634,6 +657,33 @@ proc_with_prefix test_cli_thread { mode } { match_re_or_ensure_no_output $mi_re "select thread again, event on MI" } + # In non-stop mode the current thread is still running, so we + # cannot change the selected frame. + if { $mode eq "all-stop" } { + # Use the 'frame' command to select frame 1. + with_spawn_id $gdb_main_spawn_id { + gdb_test "frame 1" [make_cli_re $mode -1 -1 1] \ + "select frame 1" + } + + with_spawn_id $mi_spawn_id { + match_re_or_ensure_no_output [make_mi_re $mode 3 1 event] \ + "select frame 1, event on MI" + } + + # Reselect the current thread. GDB will switch back to + # frame #0, and send CLI and MI notifications. + with_spawn_id $gdb_main_spawn_id { + gdb_test "thread 1.3" $cli_re \ + "select thread again, resetting frame" + } + + with_spawn_id $mi_spawn_id { + match_re_or_ensure_no_output $mi_re \ + "select thread again, resetting frame, event on MI" + } + } + # Try the 'thread' command without arguments. set cli_re "\\\[Current thread is 1\\.3 ${any}\\\]" @@ -985,7 +1035,7 @@ proc_with_prefix test_mi_stack_select_frame { mode } { # Now use the '-stack-select-frame' command with the --frame # option, this verifies that even when the frame GDB would - # swith to is the same as the frame specified with --frame, an + # switch to is the same as the frame specified with --frame, an # event is still sent to the CLI. set cli_re [make_cli_re $mode -1 -1 0] @@ -1104,18 +1154,44 @@ proc_with_prefix test_cli_in_mi_thread { mode cli_in_mi_mode } { match_re_or_ensure_no_output "$cli_re\r\n" "select thread, event on CLI" } - # Do the 'thread' command to select the same thread. We shouldn't - # receive an event on CLI, since we won't actually switch thread. - - set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.2 2 0] - set cli_re "" + # Do the 'thread' command to select the same thread. We + # should see the same thread events. with_spawn_id $mi_spawn_id { mi_gdb_test $command $mi_re "select thread again" } with_spawn_id $gdb_main_spawn_id { - match_re_or_ensure_no_output $cli_re "select thread again, event on CLI" + match_re_or_ensure_no_output "$cli_re\r\n" "select thread again, event on CLI" + } + + # In non-stop mode the current thread is still running, so we + # cannot change the selected frame. Use 'frame' command to + # select frame 1. + set f_command [make_cli_in_mi_command $cli_in_mi_mode "frame 1"] + set f_cli_re [make_cli_re $mode -1 -1 1] + set f_mi_re [make_cli_in_mi_re $f_command \ + $cli_in_mi_mode $mode 1 -1 -1 2 1] + + with_spawn_id $mi_spawn_id { + mi_gdb_test $f_command $f_mi_re "select frame 1" + } + + with_spawn_id $gdb_main_spawn_id { + match_re_or_ensure_no_output "$f_cli_re\r\n" \ + "select frame 1, event on CLI" + } + + # Reselect the current thread. GDB will switch back to + # frame #0, and send CLI and MI notifications. + with_spawn_id $mi_spawn_id { + mi_gdb_test $command $mi_re \ + "select thread again, resetting frame" + } + + with_spawn_id $gdb_main_spawn_id { + match_re_or_ensure_no_output "$cli_re\r\n" \ + "select thread again, resetting frame, event on CLI" } # Try the 'thread' command without arguments. @@ -1155,24 +1231,49 @@ proc_with_prefix test_cli_in_mi_thread { mode cli_in_mi_mode } { match_re_or_ensure_no_output "$cli_re\r\n" "select thread, event on CLI" } - # Do the 'thread' command to select the third thread again. Again, we - # shouldn't receive an event on MI. - - if { $mode == "all-stop" } { - set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.3 3 0] - } else { - set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.3 3 -1] - } - set cli_re "" + # Do the 'thread' command to select the third thread again. + # We should see the same thread events. with_spawn_id $mi_spawn_id { mi_gdb_test $command $mi_re "select thread again" } with_spawn_id $gdb_main_spawn_id { - match_re_or_ensure_no_output $cli_re "select thread again, event on CLI" + match_re_or_ensure_no_output "$cli_re\r\n" "select thread again, event on CLI" + } + + # In non-stop mode the current thread is now running, so we + # cannot switch frames. In all-stop mode all threads are + # stopped, so frame switching is fine. + if { $mode eq "all-stop" } { + # Use 'frame' command to select frame 1. + set f_command [make_cli_in_mi_command $cli_in_mi_mode "frame 1"] + set f_cli_re [make_cli_re $mode -1 -1 1] + set f_mi_re [make_cli_in_mi_re $f_command \ + $cli_in_mi_mode $mode 1 -1 -1 3 1] + with_spawn_id $mi_spawn_id { + mi_gdb_test $f_command $f_mi_re "select frame 1" + } + + with_spawn_id $gdb_main_spawn_id { + match_re_or_ensure_no_output "$f_cli_re\r\n" \ + "select frame 1, event on CLI" + } + + # Reselect the current thread. GDB will switch back to + # frame #0, and send CLI and MI notifications. + with_spawn_id $mi_spawn_id { + mi_gdb_test $command $mi_re \ + "select thread again, resetting frame" + } + + with_spawn_id $gdb_main_spawn_id { + match_re_or_ensure_no_output "$cli_re\r\n" \ + "select thread again, resetting frame, event on CLI" + } } + # Try the 'thread' command without arguments. set command [make_cli_in_mi_command $cli_in_mi_mode "thread"] @@ -1327,7 +1428,7 @@ foreach_with_prefix mode { "all-stop" "non-stop" } { set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""] } - if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } { + if { [mi_clean_restart $::testfile "separate-mi-tty"] != 0 } { break } } |