2002-11-04 Elena Zannoni <ezannoni@redhat.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Tue, 5 Nov 2002 15:43:18 +0000 (15:43 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Tue, 5 Nov 2002 15:43:18 +0000 (15:43 +0000)
        * mi-console.exp: Use mi_runto, mi_run_to_main, mi_next_to,
mi_step_to wherever possible.  Update copyright notices.
* mi-disassemble.exp: Ditto.
* mi-eval.exp: Ditto.
* mi-read-memory.exp: Ditto.
* mi-regs.exp: Ditto.
* mi-return.exp: Ditto.
* mi-stack.exp: Ditto.
* mi-stepi.exp: Ditto.
* mi-var-block.exp: Ditto.
* mi-var-cmd.exp: Ditto.
* mi-watch.exp: Ditto.
* mi1-console.exp: Ditto.
* mi1-disassemble.exp: Ditto.
* mi1-eval.exp: Ditto.
* mi1-read-memory.exp: Ditto.
* mi1-regs.exp: Ditto.
* mi1-return.exp: Ditto.
* mi1-stack.exp: Ditto.
* mi1-stepi.exp: Ditto.
* mi1-var-block.exp: Ditto.
* mi1-var-cmd.exp: Ditto.
        * mi1-watch.exp: Ditto.

23 files changed:
gdb/testsuite/gdb.mi/ChangeLog
gdb/testsuite/gdb.mi/mi-console.exp
gdb/testsuite/gdb.mi/mi-disassemble.exp
gdb/testsuite/gdb.mi/mi-eval.exp
gdb/testsuite/gdb.mi/mi-read-memory.exp
gdb/testsuite/gdb.mi/mi-regs.exp
gdb/testsuite/gdb.mi/mi-return.exp
gdb/testsuite/gdb.mi/mi-stack.exp
gdb/testsuite/gdb.mi/mi-stepi.exp
gdb/testsuite/gdb.mi/mi-var-block.exp
gdb/testsuite/gdb.mi/mi-var-cmd.exp
gdb/testsuite/gdb.mi/mi-watch.exp
gdb/testsuite/gdb.mi/mi1-console.exp
gdb/testsuite/gdb.mi/mi1-disassemble.exp
gdb/testsuite/gdb.mi/mi1-eval.exp
gdb/testsuite/gdb.mi/mi1-read-memory.exp
gdb/testsuite/gdb.mi/mi1-regs.exp
gdb/testsuite/gdb.mi/mi1-return.exp
gdb/testsuite/gdb.mi/mi1-stack.exp
gdb/testsuite/gdb.mi/mi1-stepi.exp
gdb/testsuite/gdb.mi/mi1-var-block.exp
gdb/testsuite/gdb.mi/mi1-var-cmd.exp
gdb/testsuite/gdb.mi/mi1-watch.exp

index 0a89d164601b3a8aa89731fbcaea2e58a63febaa..12af3c2e5a4c0c860474db662ba885f9f5539faa 100644 (file)
@@ -1,3 +1,29 @@
+2002-11-04  Elena Zannoni  <ezannoni@redhat.com>
+
+        * mi-console.exp: Use mi_runto, mi_run_to_main, mi_next_to,
+       mi_step_to wherever possible.  Update copyright notices.
+       * mi-disassemble.exp: Ditto.
+       * mi-eval.exp: Ditto.
+       * mi-read-memory.exp: Ditto.
+       * mi-regs.exp: Ditto.
+       * mi-return.exp: Ditto.
+       * mi-stack.exp: Ditto.
+       * mi-stepi.exp: Ditto.
+       * mi-var-block.exp: Ditto.
+       * mi-var-cmd.exp: Ditto.
+       * mi-watch.exp: Ditto.
+       * mi1-console.exp: Ditto.
+       * mi1-disassemble.exp: Ditto.
+       * mi1-eval.exp: Ditto.
+       * mi1-read-memory.exp: Ditto.
+       * mi1-regs.exp: Ditto.
+       * mi1-return.exp: Ditto.
+       * mi1-stack.exp: Ditto.
+       * mi1-stepi.exp: Ditto.
+       * mi1-var-block.exp: Ditto.
+       * mi1-var-cmd.exp: Ditto.
+        * mi1-watch.exp: Ditto.
+
 2002-10-23  Jeff Johnston  <jjohnstn@redhat.com>
 
        * mi-var-cmd.exp: Add tests to verify that a -var-assign that changes
index f8bb36efa05975c911b1cce01c4b75573a5527aa..f611aa7046e661aa24c52c171ce2309b6392825d 100644 (file)
@@ -51,22 +51,7 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-# Halt in main
-mi_gdb_test "200-break-insert main" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \
-       "break-insert operation"
-mi_run_cmd
-gdb_expect {
-    -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to main"
-    }
-    -re ".*$mi_gdb_prompt$" {
-       fail "run to main (2)"
-    }
-    timeout {
-       fail "run to main (timeout)"
-    }
-}
+mi_run_to_main
 
 # Next over the hello() call which will produce lots of output
 send_gdb "47-exec-next\n"
index 6f33d67ac6e23fbdc4dd3426adcdc740003aa57a..46f00ddf51caf97eefd0322c54a6152198b2d66f 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -43,51 +43,6 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_breakpoints_creation_and_listing {} {
-    global mi_gdb_prompt
-    global srcfile
-    global hex
-
-    # Insert some breakpoints and list them
-    # Also, disable some so they do not interfere with other tests
-    # Tests:
-    # -break-insert
-    # -break-list
-    # -break-disable
-    # -break-info
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_gdb_test "204-break-list" \
-                "204\\^done,BreakpointTable=\{.*,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \
-                "list of breakpoints"
-}
-
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args
-    # Tests:
-    # -exec-run
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # FIXME: We are accepting a duplicate file and line info temporarely.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-            pass "run to main"
-          }
-          -re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
-          timeout {fail "run to main (timeout 2)"}
-        }
-}
-
 proc test_disassembly_only {} {
     global mi_gdb_prompt
     global hex
@@ -212,8 +167,7 @@ proc test_disassembly_bogus_args {} {
 
 }
 
-test_breakpoints_creation_and_listing
-test_running_the_program
+mi_run_to_main
 test_disassembly_only
 test_disassembly_mixed
 test_disassembly_bogus_args
index 2c0141069ad92197994efc02c163f238b94fc700..536dd7915302a8f17f96398d4df5d40267efbe06 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,47 +46,8 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args, then specify srgs and rerun the program
-    # Tests:
-    # -exec-run
-
-    mi_gdb_test "300-break-insert callee4" \
-             "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "insert breakpoint at callee4"
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "run to callee4" }
-          -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-          timeout {fail "run to callee4 (timeout 2)"}
-        }
-       
-       send_gdb "101-exec-next\n"
-        gdb_expect {
-           -re "101\\^running\r\n$mi_gdb_prompt" {
-               gdb_expect {
-                   -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "next in callee4" }
-           -re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"}
-           timeout {fail "next in callee4 (timeout 2)"}
-        }
-    }
-      -re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"}
-      timeout {fail "next in callee4 (timeout 1)"}
-    }
-
-}
-
-test_running_the_program
+mi_runto callee4
+mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
 
 mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
 
index b4f0c35955fab035e09e1f8317e7d1d9baf8b487..573c8964c228b36e78c1d7615f6ed616050b42df 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,21 +46,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
 
 mi_run_to_main
-
-#mi_next "do initialization"
-send_gdb "101-exec-next\n"
-gdb_expect {
-    -re "101\\^running\r\n$mi_gdb_prompt" {
-       gdb_expect {
-           -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \
-                   { pass "do initialization" }
-           -re ".*$mi_gdb_prompt$" {fail "do initialization (2)"}
-           timeout {fail "do initialization (timeout 2)"}
-        }
-    }
-      -re ".*$mi_gdb_prompt$" {fail "do initialization (1)"}
-      timeout {fail "do initialization (timeout 1)"}
-}
+mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
 
 mi_gdb_test "1-data-read-memory" \
        "1\\^error,msg=\".*\"" \
index c427677a41bc96b17ec7dfff8d0eabfd4ce8bd2d..a6a6406a76d755b17f6178286911c90ab65c98ec 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -45,51 +45,6 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_breakpoints_creation_and_listing {} {
-    global mi_gdb_prompt
-    global srcfile
-    global hex
-
-    # Insert some breakpoints and list them
-    # Also, disable some so they do not interfere with other tests
-    # Tests:
-    # -break-insert
-    # -break-list
-    # -break-disable
-    # -break-info
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_gdb_test "204-break-list" \
-                "204\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \
-                "list of breakpoints"
-}
-
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args
-    # Tests:
-    # -exec-run
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # FIXME: We are accepting a duplicate file and line info temporarely.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-            pass "run to main"
-          }
-          -re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
-          timeout {fail "run to main (timeout 2)"}
-        }
-}
-
 proc sparc_register_tests_no_exec { } {
        # Test the generic IDT chip.
        mi_gdb_test "111-data-list-register-values" \
@@ -164,8 +119,7 @@ proc sparc_register_tests { } {
 
 if [istarget "sparc-*-*"] then {
     sparc_register_tests_no_exec
-    test_breakpoints_creation_and_listing
-    test_running_the_program
+    mi_run_to_main
     sparc_register_tests
 } else {
     verbose "mi-regs.exp tests ignored for this target"
index 1e7c863a7a8f20212775cf282305c65036b7addb..ca37e9fc9fc0fb8b53199053e68e60d3031ef32b 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,33 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_to_callee4 {} {
-    global mi_gdb_prompt
-    global hex
-
-    mi_gdb_test "200-break-insert callee4" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_run_cmd
-
-    gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to callee4"
-       }
-       -re ".*$mi_gdb_prompt$" {
-           fail "run to callee4 (2)"
-       }
-       timeout {
-           fail "run to callee4 (timeout)"
-       }
-    }
-
-    mi_gdb_test "205-break-delete" \
-                "205\\^done.*" \
-                "delete all breakpoints"
-
-}
 
 proc test_return_simple {} {
     global mi_gdb_prompt
@@ -87,7 +60,12 @@ proc test_return_simple {} {
     }
 }
 
-test_running_to_callee4
+mi_runto callee4
+
+mi_gdb_test "205-break-delete" \
+       "205\\^done.*" \
+       "delete all breakpoints"
+
 test_return_simple
 
 mi_gdb_exit
index 4c682e21e2f9ec45db2a9234a4f6b4319e8f04aa..92c651df89bf048ce57acdd3c84cedc67b780f3f 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 2000 Free Software Foundation, Inc.
+# Copyright 2000, 2002 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
@@ -46,22 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-
-mi_gdb_test "200-break-insert callee4" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to callee4"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-    timeout {fail "run to callee4 (timeout 2)"}
-}
-
-
 proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex
@@ -208,6 +192,7 @@ gdb_expect {
 
 }
 
+mi_runto callee4
 test_stack_frame_listing
 test_stack_args_listing
 test_stack_locals_listing
index e0de2f2ccd1f1ab61953eff0148669b52a717db1..44e6442150abd48b123fce1c2aa5acf5076d33e1 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,29 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_to_main {} {
-    global mi_gdb_prompt
-    global hex
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_run_cmd
-
-    gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to main"
-       }
-       -re ".*$mi_gdb_prompt$" {
-           fail "run to main (2)"
-       }
-       timeout {
-           fail "run to main (timeout)"
-       }
-    }
-}
-
 proc test_stepi_nexti {} {
     global mi_gdb_prompt
     global hex
@@ -102,7 +79,7 @@ proc test_stepi_nexti {} {
     }
 }
 
-test_running_to_main
+mi_run_to_main
 test_stepi_nexti
 
 mi_gdb_exit
index 506275c94a6efed8b226bf44bcdf3cf01536b083..a0b456a90f111a9197f3adc7a9ad456bdb942da2 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002 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
@@ -42,19 +42,7 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-mi_gdb_test "200-break-insert do_block_tests" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to do_block_tests"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"}
-    timeout {fail "run to do_block_tests (timeout 2)"}
-}
+mi_runto do_block_tests
 
 # Test: c_variable-3.2
 # Desc: create cb and foo
@@ -67,15 +55,7 @@ mi_gdb_test "-var-create foo * foo" \
        "create local variable foo"
 
 # step to "foo = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
 
 
 # Be paranoid and assume 3.2 created foo
@@ -91,15 +71,7 @@ mi_gdb_test "-var-create foo * foo" \
        "create local variable foo"
 
 # step to "foo2 = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
 
 # Test: c_variable-3.4
 # Desc: check foo, cb changed
@@ -108,15 +80,7 @@ mi_gdb_test "-var-update *" \
        "update all vars: cb foo changed"
 
 # step to "foo = 321;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test"
 
 # Test: c_variable-3.5
 # Desc: create inner block foo
@@ -125,13 +89,7 @@ mi_gdb_test "-var-create inner_foo * foo" \
        "create local variable inner_foo"
 
 # step to "foo2 = 0;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
 
 # Test: c_variable-3.6
 # Desc: create foo2
@@ -163,13 +121,7 @@ mi_gdb_test "-var-delete inner_foo" \
        "delete var inner_foo"
 
 # step to "foo = 0;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
 
 # Test: c_variable-3.8
 # Desc: check that foo2 out of scope (known gdb problem)
@@ -180,14 +132,7 @@ mi_gdb_test "-var-update foo2" \
 clear_xfail *-*-*
 
 # step to "cb = 21;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
-
+mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
 
 # Test: c_variable-3.9
 # Desc: check that only cb is in scope (known gdb problem)
index 1902793d35785b04a9a4fca79403e12cb643209c..7d02b36943a9250a718ae17475d79a3237967d51 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002 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
@@ -70,19 +70,7 @@ mi_gdb_test "113-var-create argc * argc" \
        "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
        "create out of scope variable"
 
-mi_gdb_test "200-break-insert do_locals_tests" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to do_locals_tests"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to do_locals_tests (2)"}
-    timeout {fail "run to do_locals_tests (timeout 2)"}
-}
+mi_runto do_locals_tests
 
 # Test: c_variable-1.4
 # Desc: create local variables
index 25db59869be287be5d58380087fbbbb61b7ea88d..ba243999d198a6a4b094efa39826b2fb905b4ecc 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -115,31 +115,6 @@ proc test_rwatch_creation_and_listing {} {
            "delete read watchpoint"
 }
 
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args, then specify srgs and rerun the program
-    # Tests:
-    # -exec-run
-
-    mi_gdb_test "300-break-insert callee4" \
-             "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "insert breakpoint at callee4"
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "run to callee4" }
-          -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-          timeout {fail "run to callee4 (timeout 2)"}
-        }
-}
-
 proc test_watchpoint_triggering {} {
     global mi_gdb_prompt
     global hex
@@ -181,7 +156,7 @@ proc test_watchpoint_triggering {} {
     }
 }
 
-test_running_the_program
+mi_runto callee4
 test_watchpoint_creation_and_listing
 #test_rwatch_creation_and_listing
 #test_awatch_creation_and_listing
index 5a6d6f2b897f0111078019173d0541c27c868b6d..25af50a31d1b94ebbd258c251c33e184d6a3e30c 100644 (file)
@@ -51,22 +51,7 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-# Halt in main
-mi_gdb_test "200-break-insert main" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \
-       "break-insert operation"
-mi_run_cmd
-gdb_expect {
-    -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to main"
-    }
-    -re ".*$mi_gdb_prompt$" {
-       fail "run to main (2)"
-    }
-    timeout {
-       fail "run to main (timeout)"
-    }
-}
+mi_run_to_main
 
 # Next over the hello() call which will produce lots of output
 send_gdb "47-exec-next\n"
index 65af76d245eaba9272bf33f49872cee1bc93eb26..7292a350b772eb24ceb714500c0e669af7a4d185 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -43,51 +43,6 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_breakpoints_creation_and_listing {} {
-    global mi_gdb_prompt
-    global srcfile
-    global hex
-
-    # Insert some breakpoints and list them
-    # Also, disable some so they do not interfere with other tests
-    # Tests:
-    # -break-insert
-    # -break-list
-    # -break-disable
-    # -break-info
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_gdb_test "204-break-list" \
-                "204\\^done,BreakpointTable=\{.*,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \
-                "list of breakpoints"
-}
-
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args
-    # Tests:
-    # -exec-run
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # FIXME: We are accepting a duplicate file and line info temporarely.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-            pass "run to main"
-          }
-          -re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
-          timeout {fail "run to main (timeout 2)"}
-        }
-}
-
 proc test_disassembly_only {} {
     global mi_gdb_prompt
     global hex
@@ -212,8 +167,7 @@ proc test_disassembly_bogus_args {} {
 
 }
 
-test_breakpoints_creation_and_listing
-test_running_the_program
+mi_run_to_main
 test_disassembly_only
 test_disassembly_mixed
 test_disassembly_bogus_args
index 898c7b787777e969e41d5fd82ba5760232a52b30..330e00de528cd3cdc78b2fef1f3fc490cd9fc7d6 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,47 +46,8 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args, then specify srgs and rerun the program
-    # Tests:
-    # -exec-run
-
-    mi_gdb_test "300-break-insert callee4" \
-             "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "insert breakpoint at callee4"
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "run to callee4" }
-          -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-          timeout {fail "run to callee4 (timeout 2)"}
-        }
-       
-       send_gdb "101-exec-next\n"
-        gdb_expect {
-           -re "101\\^running\r\n$mi_gdb_prompt" {
-               gdb_expect {
-                   -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "next in callee4" }
-           -re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"}
-           timeout {fail "next in callee4 (timeout 2)"}
-        }
-    }
-      -re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"}
-      timeout {fail "next in callee4 (timeout 1)"}
-    }
-
-}
-
-test_running_the_program
+mi_runto callee4
+mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
 
 mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
 
index 2796078321654d7750501ddde227ec065422bfd9..9a0acf438258ee66de01d245bffea3768fc37ebd 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -48,19 +48,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 mi_run_to_main
 
 #mi_next "do initialization"
-send_gdb "101-exec-next\n"
-gdb_expect {
-    -re "101\\^running\r\n$mi_gdb_prompt" {
-       gdb_expect {
-           -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \
-                   { pass "do initialization" }
-           -re ".*$mi_gdb_prompt$" {fail "do initialization (2)"}
-           timeout {fail "do initialization (timeout 2)"}
-        }
-    }
-      -re ".*$mi_gdb_prompt$" {fail "do initialization (1)"}
-      timeout {fail "do initialization (timeout 1)"}
-}
+
+mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
 
 mi_gdb_test "1-data-read-memory" \
        "1\\^error,msg=\".*\"" \
index b4baa18b3b0db89fa715c6429bdcaa5f6ab93015..bf59907780ecf5dc2cd2fddee44d7b443c9b215c 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -45,51 +45,6 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_breakpoints_creation_and_listing {} {
-    global mi_gdb_prompt
-    global srcfile
-    global hex
-
-    # Insert some breakpoints and list them
-    # Also, disable some so they do not interfere with other tests
-    # Tests:
-    # -break-insert
-    # -break-list
-    # -break-disable
-    # -break-info
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_gdb_test "204-break-list" \
-                "204\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \
-                "list of breakpoints"
-}
-
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args
-    # Tests:
-    # -exec-run
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # FIXME: We are accepting a duplicate file and line info temporarely.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-            pass "run to main"
-          }
-          -re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
-          timeout {fail "run to main (timeout 2)"}
-        }
-}
-
 proc sparc_register_tests_no_exec { } {
        # Test the generic IDT chip.
        mi_gdb_test "111-data-list-register-values" \
@@ -164,8 +119,7 @@ proc sparc_register_tests { } {
 
 if [istarget "sparc-*-*"] then {
     sparc_register_tests_no_exec
-    test_breakpoints_creation_and_listing
-    test_running_the_program
+    mi_run_to_main
     sparc_register_tests
 } else {
     verbose "mi-regs.exp tests ignored for this target"
index 0fcbbfe62f4fd794267e9611daf39647a3e95fcc..539a61cbf44aec873f233ffa02e79f6f2de47e4e 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,33 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_to_callee4 {} {
-    global mi_gdb_prompt
-    global hex
-
-    mi_gdb_test "200-break-insert callee4" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_run_cmd
-
-    gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to callee4"
-       }
-       -re ".*$mi_gdb_prompt$" {
-           fail "run to callee4 (2)"
-       }
-       timeout {
-           fail "run to callee4 (timeout)"
-       }
-    }
-
-    mi_gdb_test "205-break-delete" \
-                "205\\^done.*" \
-                "delete all breakpoints"
-
-}
 
 proc test_return_simple {} {
     global mi_gdb_prompt
@@ -87,7 +60,12 @@ proc test_return_simple {} {
     }
 }
 
-test_running_to_callee4
+mi_runto callee4
+
+mi_gdb_test "205-break-delete" \
+       "205\\^done.*" \
+       "delete all breakpoints"
+
 test_return_simple
 
 mi_gdb_exit
index 45b8b83a367e80c3bf376922081ae7c9bd91ca69..b8c7cab5ce37c57d94810d4874b4f08cd5654655 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 2000 Free Software Foundation, Inc.
+# Copyright 2000, 2002 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
@@ -46,22 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-
-mi_gdb_test "200-break-insert callee4" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to callee4"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-    timeout {fail "run to callee4 (timeout 2)"}
-}
-
-
 proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex
@@ -208,6 +192,7 @@ gdb_expect {
 
 }
 
+mi_runto callee4
 test_stack_frame_listing
 test_stack_args_listing
 test_stack_locals_listing
index 563447980387753b80880c438029c1d0896b64f6..a7066370f19c4ceb60336db2b0410e507b482e4f 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -46,29 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-proc test_running_to_main {} {
-    global mi_gdb_prompt
-    global hex
-
-    mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
-             "break-insert operation"
-
-    mi_run_cmd
-
-    gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
-           pass "run to main"
-       }
-       -re ".*$mi_gdb_prompt$" {
-           fail "run to main (2)"
-       }
-       timeout {
-           fail "run to main (timeout)"
-       }
-    }
-}
-
 proc test_stepi_nexti {} {
     global mi_gdb_prompt
     global hex
@@ -102,7 +79,7 @@ proc test_stepi_nexti {} {
     }
 }
 
-test_running_to_main
+mi_run_to_main
 test_stepi_nexti
 
 mi_gdb_exit
index 1478280334bd07e833cbe9738e047b66b33acd42..0ff9356ccf2a28f132f221bde40e29a6a60ccd56 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002 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
@@ -42,19 +42,7 @@ mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
-mi_gdb_test "200-break-insert do_block_tests" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to do_block_tests"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"}
-    timeout {fail "run to do_block_tests (timeout 2)"}
-}
+mi_runto do_block_tests
 
 # Test: c_variable-3.2
 # Desc: create cb and foo
@@ -67,15 +55,7 @@ mi_gdb_test "-var-create foo * foo" \
        "create local variable foo"
 
 # step to "foo = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
 
 
 # Be paranoid and assume 3.2 created foo
@@ -91,15 +71,7 @@ mi_gdb_test "-var-create foo * foo" \
        "create local variable foo"
 
 # step to "foo2 = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
 
 # Test: c_variable-3.4
 # Desc: check foo, cb changed
@@ -108,15 +80,7 @@ mi_gdb_test "-var-update *" \
        "update all vars: cb foo changed"
 
 # step to "foo = 321;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout {
-       fail "step at do_block_tests (timeout)"
-    }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test"
 
 # Test: c_variable-3.5
 # Desc: create inner block foo
@@ -125,13 +89,7 @@ mi_gdb_test "-var-create inner_foo * foo" \
        "create local variable inner_foo"
 
 # step to "foo2 = 0;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
 
 # Test: c_variable-3.6
 # Desc: create foo2
@@ -163,13 +121,7 @@ mi_gdb_test "-var-delete inner_foo" \
        "delete var inner_foo"
 
 # step to "foo = 0;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
+mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
 
 # Test: c_variable-3.8
 # Desc: check that foo2 out of scope (known gdb problem)
@@ -180,14 +132,7 @@ mi_gdb_test "-var-update foo2" \
 clear_xfail *-*-*
 
 # step to "cb = 21;"
-send_gdb "-exec-step\n"
-gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" {
-       pass "step at do_block_tests"
-    }
-    timeout { fail "step at do_block_tests (timeout)" }
-}
-
+mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
 
 # Test: c_variable-3.9
 # Desc: check that only cb is in scope (known gdb problem)
index 0f0d522b80cb68312c927a393fe456cc1613dd79..c6a88b6bd93f2f5b720a2347550e3594068fd94b 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002 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
@@ -70,19 +70,7 @@ mi_gdb_test "113-var-create argc * argc" \
        "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
        "create out of scope variable"
 
-mi_gdb_test "200-break-insert do_locals_tests" \
-       "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \
-       "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
-    -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" {
-       pass "run to do_locals_tests"
-    }
-    -re ".*$mi_gdb_prompt$" {fail "run to do_locals_tests (2)"}
-    timeout {fail "run to do_locals_tests (timeout 2)"}
-}
+mi_runto do_locals_tests
 
 # Test: c_variable-1.4
 # Desc: create local variables
index 937eb2c807c347a67b9c1764daf7bd0e44177dcd..dfb97ae59d0fcd5587784ad8b3c77230d3dfcaa3 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 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
@@ -115,31 +115,6 @@ proc test_rwatch_creation_and_listing {} {
            "delete read watchpoint"
 }
 
-proc test_running_the_program {} {
-    global mi_gdb_prompt
-    global hex
-
-    # Run the program without args, then specify srgs and rerun the program
-    # Tests:
-    # -exec-run
-
-    mi_gdb_test "300-break-insert callee4" \
-             "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
-             "insert breakpoint at callee4"
-
-    # mi_gdb_test cannot be used for asynchronous commands because there are
-    # two prompts involved and this can lead to a race condition.
-    # The following is equivalent to a send_gdb "000-exec-run\n"
-    mi_run_cmd
-    # The running part has been checked already by mi_run_cmd
-        gdb_expect {
-           -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
-                   { pass "run to callee4" }
-          -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
-          timeout {fail "run to callee4 (timeout 2)"}
-        }
-}
-
 proc test_watchpoint_triggering {} {
     global mi_gdb_prompt
     global hex
@@ -181,7 +156,7 @@ proc test_watchpoint_triggering {} {
     }
 }
 
-test_running_the_program
+mi_runto callee4
 test_watchpoint_creation_and_listing
 #test_rwatch_creation_and_listing
 #test_awatch_creation_and_listing