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]

[RFA/MI testsuite] Add mi_runto


Hi,

This is a pretty simple patch which removes the guts of mi_run_to_main and 
adds it all into a new mi_runto which does the same job as gdb's runto 
procedure.

I've tested this on the testsuite and it causes no regressions.
Keith

ChangeLog
2002-09-05  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.

Patch
Index: testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.15
diff -p -r1.15 mi-support.exp
*** testsuite/lib/mi-support.exp	4 Sep 2002 21:05:07 -0000	1.15
--- testsuite/lib/mi-support.exp	5 Sep 2002 13:33:07 -0000
*************** proc mi_run_to_main { } {
*** 621,657 ****
  	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
! 	}
      }
  }
  
  
--- 621,679 ----
  	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.
! # 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
      }
+   }
  }
  
  


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