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]

[PATCH RFA] ending-run.exp


This script seems to expect that, if you step past the return from main, 
you will end up in some sort of "start" function.

Can anyone think of any reason why "Program exited normally" is not
a legitimate output to see after stepping past the return from main?
2001-07-02  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/ending-run.exp: Accept "Program exited normally" as
	legitimate output from stepping out of main.

Index: ending-run.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ending-run.exp,v
retrieving revision 1.6
diff -c -3 -p -r1.6 ending-run.exp
*** ending-run.exp	2001/05/23 19:04:13	1.6
--- ending-run.exp	2001/07/02 21:40:58
*************** if ![gdb_skip_stdio_test "Step to return
*** 140,145 ****
--- 140,146 ----
  
  set old_timeout $timeout
  set timeout 50
+ set program_exited 0
  send_gdb "next\n"
  gdb_expect {
      -re "33.*$gdb_prompt $" {
*************** gdb_expect {
*** 160,165 ****
--- 161,171 ----
  		# This is what happens on sparc64-elf ultra.
  		pass "step out of main"
  	    }
+ 	    -re ".*Program exited normally.*$gdb_prompt $" {
+ 		# This is what happens on Linux i86 (and I would expect others)
+ 		set program_exited 1
+ 		pass "step out of main"
+ 	    }
  	    -re ".*in .nope ().*$gdb_prompt $" {
  		# This is what happens on Solaris currently -sts 1999-08-25
  		pass "step out of main on Solaris"
*************** gdb_expect {
*** 185,190 ****
--- 191,201 ----
      -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $"  {
          pass "step out of main 2"
      }
+     -re ".*Program exited normally.*$gdb_prompt $" {
+ 	# This is what happens on Linux i86 (and I would expect others)
+ 	set program_exited 1
+ 	pass "step out of main"
+     }
      -re ".*in.*currently asm.*$gdb_prompt $" { 
          pass "step out of main into assembler"
      }
*************** gdb_expect {
*** 196,236 ****
  }
  
  if {![target_info exists use_cygmon] || ![target_info use_cygmon]} {
!     send_gdb "n\n"
!     gdb_expect {
! 	-re "Program exited normally.*$gdb_prompt $" {
! 	    # If we actually have debug info for the start function,
! 	    # then we won't get the "Single-stepping until function
! 	    # exit" message.
! 	    pass "step to end of run 1"
! 	}
! 	-re ".*Single.*Program exited.*$gdb_prompt $" {
! 	    pass "step to end of run 1"
! 	}
! 	-re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" {
! 	    pass "step to end of run 2" 
! 	    gdb_test "c" ".*" "continue after exit"
! 	}
! 	timeout { fail "(timeout) step to end of run" }
      }
  
!   set timeout $old_timeout
!   
!   gdb_test "n" ".*The program is not being run.*" "don't step after run"
!   
!   set exec_output [remote_exec host "ls core"]
!   
!   
!   if [ regexp "core not found" $exec_output]  {
!     pass "No core dumped on quit"
!   } else {
!     if [ regexp "No such file or directory" $exec_output] {
!       pass "ls: core: No core dumped on quit"
      } else {
!       remote_exec build "rm -f core"
!       fail "Core dumped on quit"
      }
-   }
  }
  
  #remote_exec build "rm -f ${binfile}"
--- 207,254 ----
  }
  
  if {![target_info exists use_cygmon] || ![target_info use_cygmon]} {
!     global program_exited;
!     if {[eval expr $program_exited == 0]} {
! 	send_gdb "n\n"
! 	gdb_expect {
! 	    -re "Program exited normally.*$gdb_prompt $" {
! 		# If we actually have debug info for the start function,
! 		# then we won't get the "Single-stepping until function
! 		# exit" message.
! 		pass "step to end of run 1"
! 	    }
! 	    -re ".*Single.*Program exited.*$gdb_prompt $" {
! 		pass "step to end of run 1"
! 	    }
! 	    -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" {
! 		pass "step to end of run 2" 
! 		gdb_test "c" ".*" "continue after exit"
! 	    }
! 	    -re ".*$gdb_prompt $" {
! 		fail "step to end of run"
! 	    }
! 	    timeout { 
! 		fail "(timeout) step to end of run" 
! 	    }
! 	}   
      }
+ 
+     set timeout $old_timeout
  
!     gdb_test "n" ".*The program is not being run.*" "don't step after run"
! 
!     set exec_output [remote_exec host "ls core"]
! 
!     if [ regexp "core not found" $exec_output]  {
! 	pass "No core dumped on quit"
      } else {
! 	if [ regexp "No such file or directory" $exec_output] {
! 	    pass "ls: core: No core dumped on quit"
! 	} else {
! 	    remote_exec build "rm -f core"
! 	    fail "Core dumped on quit"
! 	}
      }
  }
  
  #remote_exec build "rm -f ${binfile}"

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