This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/MI testsuite] Add mi_runto


Keith Seitz writes:
 > On Tue, 10 Sep 2002, Elena Zannoni wrote:
 > 
 > > Oh ok. mi_run_to executes an inferior that has already started.
 > > While mi_runto starts it from scratch.
 > > 
 > > Could we rename mi_run_to to something like mi_execute_to instead?
 > > It is used only in mi-var-cmd.exp.
 > 
 > Sure.
 > 
 > > And add your paragraph above in mi-support.exp as a comment?
 > 
 > Done.
 > 
 > How's this? (I've run all this on linux native, and it shows no 
 > regressions.)
 > 

Super.
thanks
Elena


 > Keith
 > 
 > testsuite/ChangeLog
 > 2002-09-10  Keith Seitz  <keiths@redhat.com>
 > 
 >         * lib/mi-support.exp (mi_runto): New proc. Does the same as gdb's
 >         runto proc.
 >         (mi_run_to_main): Use mi_runto.
 >         (mi_execute_to): Renamed from mi_run_to. Changed all callers.
 > 
 > 
 > testsuite/gdb.mi/ChangeLog
 > 2002-09-10  Keith Seitz  <keiths@redhat.com>
 > 
 >         * mi-simplerun.exp (test_controlled_execution): Follow renaming of
 >         mi_run_to to mi_execute_to.
 >         * mi-var-cmd.exp: Likewise.
 > 	* mi0-simplerun.exp: Likewise.
 > 	* mi0-var-cmd.exp: Likewise.
 > 
 > Patches
 > Index: testsuite/lib/mi-support.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
 > retrieving revision 1.16
 > diff -p -r1.16 mi-support.exp
 > *** testsuite/lib/mi-support.exp	10 Sep 2002 22:07:58 -0000	1.16
 > --- testsuite/lib/mi-support.exp	10 Sep 2002 22:17:52 -0000
 > *************** proc mi_run_to_main { } {
 > *** 621,662 ****
 >   	return -1
 >       }
 >   
 > -     global mi_gdb_prompt
 > -     global hex
 > -     global decimal
 >       global srcdir
 >       global subdir
 >       global binfile
 >       global srcfile
 >   
 > -     set test "mi run-to-main"
 >       mi_delete_breakpoints
 >       mi_gdb_reinitialize_dir $srcdir/$subdir
 >       mi_gdb_load ${binfile}
 >   
 > !     mi_gdb_test "200-break-insert main" \
 > ! 	    "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
 > ! 	    "breakpoint at main"
 >   
 > !     mi_run_cmd
 > !     gdb_expect {
 > ! 	-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[\\\]\|\{\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
 > ! 	    pass "$test"
 > ! 	    return 0
 > ! 	}
 > ! 	-re ".*$mi_gdb_prompt$" {
 > ! 	    fail "$test (2)"
 > ! 	}
 > ! 	timeout {
 > ! 	    fail "$test (timeout)"
 > ! 	    return -1
 > ! 	}
 >       }
 >   }
 >   
 >   
 >   # Next to the next statement
 > ! # For return values, see mi_run_to_helper
 >   
 >   proc mi_next { test } {
 >     return [mi_next_to {.*} {.*} {.*} {.*} $test]
 > --- 621,687 ----
 >   	return -1
 >       }
 >   
 >       global srcdir
 >       global subdir
 >       global binfile
 >       global srcfile
 >   
 >       mi_delete_breakpoints
 >       mi_gdb_reinitialize_dir $srcdir/$subdir
 >       mi_gdb_load ${binfile}
 >   
 > !     mi_runto main
 > ! }
 >   
 > ! 
 > ! # Just like gdb's "runto" proc, it will run the target to a given
 > ! # function.  The big difference here between mi_runto and mi_execute_to
 > ! # is that mi_execute_to must have the inferior running already.  This
 > ! # proc will (like gdb's runto) (re)start the inferior, too.
 > ! #
 > ! # FUNC is the linespec of the place to stop (it inserts a breakpoint here).
 > ! # It returns:
 > ! #   -1  if test suppressed, failed, timedout
 > ! #    0  if test passed
 > ! 
 > ! proc mi_runto {func} {
 > !   global suppress_flag
 > !   if { $suppress_flag } {
 > !     return -1
 > !   }
 > ! 
 > !   global mi_gdb_prompt expect_out
 > !   global hex decimal
 > ! 
 > !   set test "mi runto $func"
 > !   mi_gdb_test "200-break-insert $func" \
 > !     "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
 > !     "breakpoint at $func"
 > ! 
 > !   if {![regexp {number="[0-9]+"} $expect_out(buffer) str]
 > !       || ![scan $str {number="%d"} bkptno]} {
 > !     set bkptno {[0-9]+}
 > !   }
 > ! 
 > !   mi_run_cmd
 > !   gdb_expect {
 > !     -re ".*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"$bkptno\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
 > !       pass "$test"
 > !       return 0
 > !     }
 > !     -re ".*$mi_gdb_prompt$" {
 > !       fail "$test (2)"
 > !     }
 > !     timeout {
 > !       fail "$test (timeout)"
 > !       return -1
 >       }
 > +   }
 >   }
 >   
 >   
 >   # Next to the next statement
 > ! # For return values, see mi_execute_to_helper
 >   
 >   proc mi_next { test } {
 >     return [mi_next_to {.*} {.*} {.*} {.*} $test]
 > *************** proc mi_next { test } {
 > *** 664,670 ****
 >   
 >   
 >   # Step to the next statement
 > ! # For return values, see mi_run_to_helper
 >   
 >   proc mi_step { test } {
 >     return [mi_step_to {.*} {.*} {.*} {.*} $test]
 > --- 689,695 ----
 >   
 >   
 >   # Step to the next statement
 > ! # For return values, see mi_execute_to_helper
 >   
 >   proc mi_step { test } {
 >     return [mi_step_to {.*} {.*} {.*} {.*} $test]
 > *************** proc mi_step { test } {
 > *** 676,682 ****
 >   # Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives
 >   # after the first prompt is printed.
 >   
 > ! proc mi_run_to_helper { cmd reason func args file line extra test } {
 >       global suppress_flag
 >       if { $suppress_flag } {
 >   	return -1
 > --- 701,707 ----
 >   # Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives
 >   # after the first prompt is printed.
 >   
 > ! proc mi_execute_to_helper { cmd reason func args file line extra test } {
 >       global suppress_flag
 >       if { $suppress_flag } {
 >   	return -1
 > *************** proc mi_run_to_helper { cmd reason func 
 > *** 705,760 ****
 >       }
 >   }
 >   
 > ! proc mi_run_to { cmd reason func args file line extra test } {
 > !     mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
 >   	"$file" "$line" "$extra" "$test"
 >   }
 >   
 >   proc mi_next_to { func args file line test } {
 > !     mi_run_to "exec-next" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi_step_to { func args file line test } {
 > !     mi_run_to "exec-step" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi_finish_to { func args file line result ret test } {
 > !     mi_run_to "exec-finish" "function-finished" "$func" "$args" \
 >   	"$file" "$line" \
 >   	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
 >   	"$test"
 >   }
 >   
 >   proc mi_continue_to { bkptno func args file line test } {
 > !     mi_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
 >   	"$func" "$args" "$file" "$line" "" "$test"
 >   }
 >   
 > ! proc mi0_run_to { cmd reason func args file line extra test } {
 > !     mi_run_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
 >   	"$file" "$line" "$extra" "$test"
 >   }
 >   
 >   proc mi0_next_to { func args file line test } {
 > !     mi0_run_to "exec-next" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi0_step_to { func args file line test } {
 > !     mi0_run_to "exec-step" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi0_finish_to { func args file line result ret test } {
 > !     mi0_run_to "exec-finish" "function-finished" "$func" "$args" \
 >   	"$file" "$line" \
 >   	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
 >   	"$test"
 >   }
 >   
 >   proc mi0_continue_to { bkptno func args file line test } {
 > !     mi0_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
 >   	"$func" "$args" "$file" "$line" "" "$test"
 >   }
 > --- 730,785 ----
 >       }
 >   }
 >   
 > ! proc mi_execute_to { cmd reason func args file line extra test } {
 > !     mi_execute_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
 >   	"$file" "$line" "$extra" "$test"
 >   }
 >   
 >   proc mi_next_to { func args file line test } {
 > !     mi_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi_step_to { func args file line test } {
 > !     mi_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi_finish_to { func args file line result ret test } {
 > !     mi_execute_to "exec-finish" "function-finished" "$func" "$args" \
 >   	"$file" "$line" \
 >   	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
 >   	"$test"
 >   }
 >   
 >   proc mi_continue_to { bkptno func args file line test } {
 > !     mi_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
 >   	"$func" "$args" "$file" "$line" "" "$test"
 >   }
 >   
 > ! proc mi0_execute_to { cmd reason func args file line extra test } {
 > !     mi_execute_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
 >   	"$file" "$line" "$extra" "$test"
 >   }
 >   
 >   proc mi0_next_to { func args file line test } {
 > !     mi0_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi0_step_to { func args file line test } {
 > !     mi0_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
 >   	"$file" "$line" "" "$test"
 >   }
 >   
 >   proc mi0_finish_to { func args file line result ret test } {
 > !     mi0_execute_to "exec-finish" "function-finished" "$func" "$args" \
 >   	"$file" "$line" \
 >   	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
 >   	"$test"
 >   }
 >   
 >   proc mi0_continue_to { bkptno func args file line test } {
 > !     mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
 >   	"$func" "$args" "$file" "$line" "" "$test"
 >   }
 > Index: testsuite/gdb.mi/mi-simplerun.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-simplerun.exp,v
 > retrieving revision 1.9
 > diff -p -r1.9 mi-simplerun.exp
 > *** testsuite/gdb.mi/mi-simplerun.exp	11 Nov 2001 20:11:03 -0000	1.9
 > --- testsuite/gdb.mi/mi-simplerun.exp	10 Sep 2002 22:18:15 -0000
 > *************** proc test_controlled_execution {} {
 > *** 140,146 ****
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 >       #        we should look for the right thing here.
 > !     mi_run_to "exec-step 3" "end-stepping-range" "callee4" "" \
 >   	"basics.c" "8" "" "step to callee4"
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 > --- 140,146 ----
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 >       #        we should look for the right thing here.
 > !     mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
 >   	"basics.c" "8" "" "step to callee4"
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 > Index: testsuite/gdb.mi/mi-var-cmd.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
 > retrieving revision 1.9
 > diff -p -r1.9 mi-var-cmd.exp
 > *** testsuite/gdb.mi/mi-var-cmd.exp	5 Mar 2002 19:48:17 -0000	1.9
 > --- testsuite/gdb.mi/mi-var-cmd.exp	10 Sep 2002 22:18:30 -0000
 > *************** mi_gdb_test "-var-update *" \
 > *** 227,233 ****
 >   #  lsimple.unsigned_integer = 255;
 >   #  lsimple.character = 'a';
 >   
 > ! mi_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 >   
 >   # Test: c_variable-2.6
 > --- 227,233 ----
 >   #  lsimple.unsigned_integer = 255;
 >   #  lsimple.character = 'a';
 >   
 > ! mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 >   
 >   # Test: c_variable-2.6
 > *************** mi_gdb_test "-var-update *" \
 > *** 243,249 ****
 >   #  lpsimple = &lsimple;
 >   #  func = nothing;
 >   
 > ! mi_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 >   
 >   # Test: c_variable-2.7
 > --- 243,249 ----
 >   #  lpsimple = &lsimple;
 >   #  func = nothing;
 >   
 > ! mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 >   
 >   # Test: c_variable-2.7
 > *************** mi_gdb_test "-var-update *" \
 > *** 262,268 ****
 >   #  lsimple.unsigned_integer = 4321;
 >   #  lsimple.character = 'b';
 >   
 > ! mi_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 >   
 >   # Test: c_variable-2.8
 > --- 262,268 ----
 >   #  lsimple.unsigned_integer = 4321;
 >   #  lsimple.character = 'b';
 >   
 > ! mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 >   
 >   # Test: c_variable-2.8
 > Index: testsuite/gdb.mi/mi0-simplerun.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-simplerun.exp,v
 > retrieving revision 1.6
 > diff -p -r1.6 mi0-simplerun.exp
 > *** testsuite/gdb.mi/mi0-simplerun.exp	11 Nov 2001 20:11:03 -0000	1.6
 > --- testsuite/gdb.mi/mi0-simplerun.exp	10 Sep 2002 22:21:40 -0000
 > *************** proc test_controlled_execution {} {
 > *** 142,148 ****
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 >       #        we should look for the right thing here.
 > !     mi0_run_to "exec-step 3" "end-stepping-range" "callee4" "" \
 >   	"basics.c" "8" "" "step to callee4"
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 > --- 142,148 ----
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 >       #        we should look for the right thing here.
 > !     mi0_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
 >   	"basics.c" "8" "" "step to callee4"
 >   
 >       # FIXME: A string argument is not printed right; should be fixed and
 > Index: testsuite/gdb.mi/mi0-var-cmd.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-cmd.exp,v
 > retrieving revision 1.7
 > diff -p -r1.7 mi0-var-cmd.exp
 > *** testsuite/gdb.mi/mi0-var-cmd.exp	5 Mar 2002 19:48:18 -0000	1.7
 > --- testsuite/gdb.mi/mi0-var-cmd.exp	10 Sep 2002 22:21:51 -0000
 > *************** mi_gdb_test "-var-update *" \
 > *** 227,233 ****
 >   #  lsimple.unsigned_integer = 255;
 >   #  lsimple.character = 'a';
 >   
 > ! mi0_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 >   
 >   # Test: c_variable-2.6
 > --- 227,233 ----
 >   #  lsimple.unsigned_integer = 255;
 >   #  lsimple.character = 'a';
 >   
 > ! mi0_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "119" "" "step at do_locals_tests (5)"
 >   
 >   # Test: c_variable-2.6
 > *************** mi_gdb_test "-var-update *" \
 > *** 243,249 ****
 >   #  lpsimple = &lsimple;
 >   #  func = nothing;
 >   
 > ! mi0_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 >   
 >   # Test: c_variable-2.7
 > --- 243,249 ----
 >   #  lpsimple = &lsimple;
 >   #  func = nothing;
 >   
 > ! mi0_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "125" "" "step at do_locals_tests (6)"
 >   
 >   # Test: c_variable-2.7
 > *************** mi_gdb_test "-var-update *" \
 > *** 262,268 ****
 >   #  lsimple.unsigned_integer = 4321;
 >   #  lsimple.character = 'b';
 >   
 > ! mi0_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 >   
 >   # Test: c_variable-2.8
 > --- 262,268 ----
 >   #  lsimple.unsigned_integer = 4321;
 >   #  lsimple.character = 'b';
 >   
 > ! mi0_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
 >   	"var-cmd.c" "133" "" "step at do_locals_tests (7)"
 >   
 >   # Test: c_variable-2.8


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]