This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


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

Re: Bogus stepi/nexti test



> The stepi/nexti tests in gdb.base/step-test.exp are completely bogus and
> must be removed.

I took a different approach.  This isn't in GDB yet.  Your comments
would be welcome.


1999-03-03  Jim Blandy  <jimb@zwingli.cygnus.com>

	* gdb.base/step-test.exp: Rewrite `stepi' and `nexti' tests to be
	more portable.

Index: step-test.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/step-test.exp,v
retrieving revision 1.2
diff -c -c -r1.2 step-test.exp
*** step-test.exp	1999/02/05 02:56:20	1.2
--- step-test.exp	1999/03/04 04:38:50
***************
*** 67,86 ****
  
  # Step out of call
  #
  gdb_test "finish" ".*30.*a.*5.*= a.*3.*" "step out"
  
! # Instruction stepping, into
! #
! gdb_test "stepi"  ".*30.*a.*5.* = a.*3.*"  "stepi 1"
! gdb_test "stepi"  ".*30.*a\\\[5\\\] = a.*" "stepi 2"
  
! gdb_test "stepi 7" ".*6.*glob.*"           "stepi into"
! gdb_test "finish"  ".*34.*callee.*NEXTI.*" "stepi out"
  
! # Instruction stepping, over
! #
! gdb_test "nexti"    ".*callee.*NEXTI.*"     "nexti 1"
  
! gdb_test "c" ".*Program exited normally.*" "run to finish"
  
  return 0
--- 67,138 ----
  
  # Step out of call
  #
+ # I wonder if this is really portable.  Are there any caller-saves
+ # platforms, on which `finish' will return you to some kind of pop
+ # instruction, which is attributed to the line containing the function
+ # call?
  gdb_test "finish" ".*30.*a.*5.*= a.*3.*" "step out"
  
! ### Testing nexti and stepi.
! ###
! ### test_i NAME COMMAND HERE THERE
! ###
! ### Send COMMAND to gdb over and over, while the output matches the
! ### regexp HERE, followed by the gdb prompt.  Pass if the output
! ### eventually matches the regexp THERE, followed by the gdb prompt;
! ### fail if we have to iterate more than a hundred times, we time out
! ### talking to gdb, or we get output which is neither HERE nor THERE.  :)
! ###
! ### Use NAME as the name of the test.
! ###
! ### The exact regexps used are "$HERE.*$gdb_prompt $"
! ###                        and "$THERE.*$gdb_prompt $"
! ### 
! proc test_i {name command here there} {
!     global gdb_prompt
!     
!     set i 0
!     while 1 {
! 	send_gdb "${command}\n"
! 	gdb_expect {
! 	    -re "$here.*$gdb_prompt $" {
! 		# Okay, we're still on the same line.  Just step again.
! 	    }
! 	    -re "$there.*$gdb_prompt $" {
! 		# We've reached the next line.  Rah.
! 		pass "$name"
! 		return
! 	    }
! 	    -re "$gdb_prompt $" {
! 		# We got something else.  Fail.
! 		fail "$name"
! 		return
! 	    }
! 	    timeout {
! 		fail "$name (timeout)"
! 		return
! 	    }
! 	}
  
! 	# Have we gone for too many steps without seeing any progress?
! 	if {[incr i] >= 100} {
! 	    fail "$name"
! 	    return
! 	}
!     }
! }
  
! test_i "stepi to next line" "stepi" \
!        ".*30.*a.*5.* = a.*3" \
!        ".*31.*callee.*STEPI"
! test_i "stepi into function" "stepi" \
!        ".*31.*callee.*STEPI" \
!        ".*callee \\(\\) at .*step-test\\.c"
! gdb_test "finish"  ".*34.*callee.*NEXTI.*" "stepi: finish call"
! test_i "nexti over function" "nexti" \
!        ".*34.*callee.*NEXTI" \
!        ".*36.*y = w \\+ z;"
  
! gdb_test "continue" ".*Program exited normally.*" "run to finish"
  
  return 0