This is the mail archive of the gdb-patches@sourceware.org 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]

Simplify mi_continue_to


The MI test use a helper function mi_continue_to, that is troublesome to use. First one
has to set a breakpoint, and then use mi_continue_to passing it a bunch of parameters,
where in practice most of them end up being ".*".

At the same time, we have perfectly working mi_runto that needs just function name.
This patch refactor mi_continue_to to work just like mi_runto and simplifies the tests
that use mi_continue_to. 

No regressions on x86, OK?

- Volodya

	Simplify usage of mi_continue_to.
	* lib/mi-support.exp (mi_runto_helper): Renamed
	from mi_runto, added new parameter 'run_or_continue'.
	(mi_runto): Use mi_runto_helper.
	(mi_continue_to): Accept just function name as parameter.
	Use mi_runto_helper.
	* gdb.mi/mi-var-cmd.exp: Adjust to changes.
	* gdb.mi/mi2-var-cmd.exp: Likewise.
--- gdb/testsuite/gdb.mi/mi-var-cmd.exp	(/mirrors/gdb_mainline)	(revision 2738)
+++ gdb/testsuite/gdb.mi/mi-var-cmd.exp	(/patches/gdb/mi_continue_to/gdb_mainline)	(revision 2738)
@@ -425,12 +425,7 @@ mi_gdb_test "-var-update *" \
 
 set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
 
-mi_gdb_test "-break-insert subroutine1" \
-	"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",times=\"0\"\}" \
-	"break-insert subroutine1"
-mi_continue_to "2" "subroutine1" \
-	"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
-	"var-cmd.c" $line_subroutine1_body "continue to subroutine1"
+mi_continue_to subroutine1
 
 # Test: c_variable-2.10
 # Desc: create variable for locals i,l in subroutine1
@@ -572,21 +567,13 @@ mi_gdb_test "-var-delete l" \
 
 # Test whether we can follow the name of a variable through multiple
 # stack frames.
-mi_gdb_test "-break-insert do_special_tests" \
-  {\^done,bkpt=.*} \
-  "set breakpoint at do_special_tests"
-
-mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
+mi_continue_to do_special_tests
 
 mi_gdb_test "-var-create selected_a @ a" \
   {\^done,name="selected_a",numchild="0",type="int"} \
   "create selected_a"
 
-mi_gdb_test "-break-insert incr_a" \
-  {\^done,bkpt=.*} \
-  "set breakpoint at incr_a"
-
-mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
+mi_continue_to incr_a
 
 mi_gdb_test "-var-update selected_a" \
 	"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
--- gdb/testsuite/gdb.mi/mi2-var-cmd.exp	(/mirrors/gdb_mainline)	(revision 2738)
+++ gdb/testsuite/gdb.mi/mi2-var-cmd.exp	(/patches/gdb/mi_continue_to/gdb_mainline)	(revision 2738)
@@ -388,12 +388,7 @@ mi_gdb_test "-var-assign lsimple.integer
 
 set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
 
-mi_gdb_test "-break-insert subroutine1" \
-	"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",times=\"0\"\}" \
-	"break-insert subroutine1"
-mi_continue_to "2" "subroutine1" \
-	"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
-	"var-cmd.c" $line_subroutine1_body "continue to subroutine1"
+mi_continue_to "subroutine1"
 
 # Test: c_variable-2.10
 # Desc: create variable for locals i,l in subroutine1
@@ -535,21 +530,13 @@ mi_gdb_test "-var-delete l" \
 
 # Test whether we can follow the name of a variable through multiple
 # stack frames.
-mi_gdb_test "-break-insert do_special_tests" \
-  {\^done,bkpt=.*} \
-  "set breakpoint at do_special_tests"
-
-mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
+mi_continue_to do_special_tests
 
 mi_gdb_test "-var-create selected_a @ a" \
   {\^done,name="selected_a",numchild="0",type="int"} \
   "create selected_a"
 
-mi_gdb_test "-break-insert incr_a" \
-  {\^done,bkpt=.*} \
-  "set breakpoint at incr_a"
-
-mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
+mi_continue_to incr_a
 
 mi_gdb_test "-var-update selected_a" \
 	"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
--- gdb/testsuite/lib/mi-support.exp	(/mirrors/gdb_mainline)	(revision 2738)
+++ gdb/testsuite/lib/mi-support.exp	(/patches/gdb/mi_continue_to/gdb_mainline)	(revision 2738)
@@ -858,7 +858,7 @@ proc mi_run_to_main { } {
 #   -1  if test suppressed, failed, timedout
 #    0  if test passed
 
-proc mi_runto {func} {
+proc mi_runto_helper {func run_or_continue} {
   global suppress_flag
   if { $suppress_flag } {
     return -1
@@ -877,7 +877,11 @@ proc mi_runto {func} {
     set bkptno {[0-9]+}
   }
 
-  mi_run_cmd
+  if {$run_or_continue == "run"} {
+      mi_run_cmd
+  } else {
+    send_gdb "000-exec-continue\n"
+  }
   gdb_expect {
     -re ".*000\\*stopped,thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
       pass "$test"
@@ -893,6 +897,9 @@ proc mi_runto {func} {
   }
 }
 
+proc mi_runto {func} {
+    mi_runto_helper $func "run"
+}
 
 # Next to the next statement
 # For return values, see mi_execute_to_helper
@@ -967,9 +974,8 @@ proc mi_finish_to { func args file line 
 	"$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 mi_continue_to {func} {
+    mi_runto_helper $func "continue"
 }
 
 proc mi0_execute_to { cmd reason func args file line extra test } {

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