From f71e6719e1c2dde20e3286ca7c4969f1c10eb523 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 2 Sep 2020 23:06:19 +0100 Subject: Introduce mi_runto_main This adds an mi_runto_main routine, very much like the runto_main CLI counterpart. Note there's already a mi_run_to_main (extra underscore in "run_to"), but unlike its intro comment says, that does more than the CLI's runto_main -- it also starts GDB. I would like to eliminate that other one by introducing a mi_clean_restart function instead. That is done later in the series. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_runto_main): New proc. (mi_run_to_main): Use it. * gdb.mi/mi-catch-cpp-exceptions.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-invalidate.exp: Likewise. * mi-var-list-children-invalid-grandchild.exp: Likewise. * gdb.mi/mi2-amd64-entry-value.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.opt/inline-cmds.exp: Likewise. * gdb.python/py-framefilter-mi.exp: Likewise. * gdb.python/py-mi.exp: Likewise. Change-Id: I2e49ca7b0b61cea57c1202e5dfa32417e6a4403d --- gdb/testsuite/ChangeLog | 15 +++++++++++++++ gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp | 2 +- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 2 +- gdb/testsuite/gdb.mi/mi-var-invalidate.exp | 2 +- .../gdb.mi/mi-var-list-children-invalid-grandchild.exp | 2 +- gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp | 14 +++++++------- gdb/testsuite/gdb.mi/new-ui-mi-sync.exp | 2 +- gdb/testsuite/gdb.mi/user-selected-context-sync.exp | 2 +- gdb/testsuite/gdb.opt/inline-cmds.exp | 2 +- gdb/testsuite/gdb.python/py-framefilter-mi.exp | 2 +- gdb/testsuite/gdb.python/py-mi.exp | 4 ++-- gdb/testsuite/lib/mi-support.exp | 8 +++++++- 12 files changed, 39 insertions(+), 18 deletions(-) (limited to 'gdb') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6248618451c..19b4e2b138c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2020-10-13 Pedro Alves + + * lib/mi-support.exp (mi_runto_main): New proc. + (mi_run_to_main): Use it. + * gdb.mi/mi-catch-cpp-exceptions.exp: Likewise. + * gdb.mi/mi-var-cmd.exp: Likewise. + * gdb.mi/mi-var-invalidate.exp: Likewise. + * mi-var-list-children-invalid-grandchild.exp: Likewise. + * gdb.mi/mi2-amd64-entry-value.exp: Likewise. + * gdb.mi/new-ui-mi-sync.exp: Likewise. + * gdb.mi/user-selected-context-sync.exp: Likewise. + * gdb.opt/inline-cmds.exp: Likewise. + * gdb.python/py-framefilter-mi.exp: Likewise. + * gdb.python/py-mi.exp: Likewise. + 2020-10-13 Pedro Alves * gdb.ada/fun_in_declare.exp: Use "runto_main" instead of diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp index 40c17c68e63..14e820fa350 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp @@ -59,7 +59,7 @@ proc restart_for_test {} { mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} - mi_runto main + mi_runto_main mi_create_breakpoint \ "$srcfile:${main_lineno}" "break before exiting program" \ diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 260917a906b..c521a18bf6e 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -657,7 +657,7 @@ with_test_prefix "second run" { mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj" mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value" -mi_runto main +mi_runto_main mi_gdb_test "-var-update L" \ {\^done,changelist=\[{name="L",in_scope="false",type_changed="false",has_more="0"}\]} \ diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp index d6fb7754766..bc056b92d8b 100644 --- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp +++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp @@ -70,7 +70,7 @@ mi_create_floating_varobj float_simple array "create floating variable" # mi_delete_breakpoints mi_gdb_load ${binfile_bis} -mi_runto main +mi_runto_main # Change format of floating variable immediately after reload reveals a # bug where gdb still uses a free'd pointer. 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 78ad1e1e4b2..b34593546d3 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 @@ -43,7 +43,7 @@ mi_gdb_test "-interpreter-exec console \"set print object on\"" \ "(.*=cmd-param-changed,param=\"print object\",value=\"on\".*|)\\^done" \ "set print object on" -mi_runto main +mi_runto_main mi_continue_to_line $line_invalid_pointer_value "continue to invalid pointer value" diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp index c9e5724bee3..b8d2cd16bf4 100644 --- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp +++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp @@ -49,7 +49,7 @@ foreach name {different breakhere_different breakhere_validity breakhere_invalid # Test various kinds of `set print entry-values'. -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values no" {\^done} "no: set print entry-values" @@ -66,7 +66,7 @@ mi_send_resuming_command "exec-continue" "no: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv",value=""}} .* .* {.* disp="keep"} "no: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value=""}\]} "no: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values" @@ -83,7 +83,7 @@ mi_send_resuming_command "exec-continue" "only: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value=""}} .* .* {.* disp="keep"} "only: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value=""}\]} "only: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values preferred" {\^done} "preferred: set print entry-values" @@ -100,7 +100,7 @@ mi_send_resuming_command "exec-continue" "preferred: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value=""}} .* .* {.* disp="keep"} "preferred: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value=""}\]} "preferred: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} "if-needed: set print entry-values" @@ -117,7 +117,7 @@ mi_send_resuming_command "exec-continue" "if-needed: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv",value=""}} .* .* {.* disp="keep"} "if-needed: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value=""}\]} "if-needed: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values both" {\^done} "both: set print entry-values" @@ -134,7 +134,7 @@ mi_send_resuming_command "exec-continue" "both: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv",value=""},{name="inv@entry",value=""}} .* .* {.* disp="keep"} "both: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value=""},{name="inv@entry",arg="1",value=""}\]} "both: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values compact" {\^done} "compact: set print entry-values" @@ -151,7 +151,7 @@ mi_send_resuming_command "exec-continue" "compact: invalid: continue" mi_expect_stop "breakpoint-hit" .* {{name="inv",value=""}} .* .* {.* disp="keep"} "compact: invalid: stop" mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value=""}\]} "compact: invalid: -stack-list-variables" -if {[mi_runto main] == -1} { +if {[mi_runto_main] == -1} { return -1 } mi_gdb_test "-gdb-set print entry-values default" {\^done} "default: set print entry-values" diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp index a55fae67dfe..83a8d5ff4a4 100644 --- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp @@ -63,7 +63,7 @@ proc do_test {sync_command} { return } } else { - if {[mi_runto main] < 0} { + if {[mi_runto_main] < 0} { return } if {[mi_send_resuming_command_raw "123-exec-continue" $test] >= 0} { diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index 390df005542..ed39443eb73 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -401,7 +401,7 @@ proc_with_prefix test_setup { mode } { mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load $binfile - if { [mi_runto main] < 0 } { + if { [mi_runto_main] < 0 } { fail "can't run to main" return } diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp index 94314fe2e4c..516d76139cd 100644 --- a/gdb/testsuite/gdb.opt/inline-cmds.exp +++ b/gdb/testsuite/gdb.opt/inline-cmds.exp @@ -355,7 +355,7 @@ with_test_prefix "mi" { continue } mi_gdb_load ${binfile} - mi_runto main + mi_runto_main set line_number [gdb_get_line_number "set mi break here"] mi_gdb_test "-break-insert ${srcfile}:${line_number}" \ diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp index 244ec1a2b6b..feb58111f4b 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp @@ -42,7 +42,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} { return -1 } -mi_runto main +mi_runto_main set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}] diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index abaa380186e..7216c4141d6 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -40,7 +40,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} { return -1 } -mi_runto main +mi_runto_main set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}] @@ -347,7 +347,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} { return -1 } -mi_runto main +mi_runto_main mi_continue_to_line \ [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \ "step to breakpoint" diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 0e7524ed0f6..732aed27b27 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1042,7 +1042,7 @@ proc mi_run_to_main { } { mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} - mi_runto main + mi_runto_main } @@ -1086,6 +1086,12 @@ proc mi_runto {func} { return [mi_runto_helper $func "run"] } +# Just like runto_main but works with the MI interface. + +proc mi_runto_main {} { + return [mi_runto_helper "main" "run"] +} + # Next to the next statement # For return values, see mi_execute_to_helper -- cgit v1.2.1