summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/foll-exec.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/foll-exec.exp')
-rw-r--r--gdb/testsuite/gdb.base/foll-exec.exp65
1 files changed, 16 insertions, 49 deletions
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 5bea3badc04..0a6347c82fd 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -13,6 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This is a test of gdb's ability to follow a process through a
+# Unix exec() system call.
+
if { [is_remote target] || ![isnative] } then {
continue
}
@@ -44,44 +47,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $com
return -1
}
-proc zap_session {} {
- global gdb_prompt
- global binfile
-
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $" {
- gdb_test_no_output "y" ""
- send_gdb "file $binfile\n"
- gdb_expect {
- -re ".*Load new symbol table from.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from.*$gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*$gdb_prompt $" {}
- timeout { fail "killing inferior (timeout)" ; return }
- }
-}
-
proc do_exec_tests {} {
+ global binfile srcfile srcfile2 testfile testfile2
global gdb_prompt
- global binfile
- global srcfile
- global srcfile2
- global testfile
- global testfile2
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile}"
+ fail "Couldn't run ${testfile}"
return
}
@@ -103,12 +76,12 @@ proc do_exec_tests {} {
return
}
- zap_session
+ clean_restart $binfile
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile}"
+ fail "Couldn't run ${testfile}"
return
}
@@ -192,12 +165,12 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- zap_session
+ clean_restart $binfile
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile} (2nd try)"
+ fail "Couldn't run ${testfile} (2nd try)"
return
}
@@ -265,12 +238,12 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- zap_session
+ clean_restart $binfile
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile} (3rd try)"
+ fail "Couldn't run ${testfile} (3rd try)"
return
}
@@ -326,12 +299,12 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- zap_session
+ clean_restart $binfile
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile} (4th try)"
+ fail "Couldn't run ${testfile} (4th try)"
return
}
@@ -381,12 +354,12 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- zap_session
+ clean_restart $binfile
# Start the program running, and stop at main.
#
if ![runto_main] then {
- perror "Couldn't run ${testfile} (5th try)"
+ fail "Couldn't run ${testfile} (5th try)"
return
}
@@ -406,14 +379,8 @@ proc do_exec_tests {} {
# Start with a fresh gdb
gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
+clean_restart $binfile
-# This is a test of gdb's ability to follow a process through a
-# Unix exec() system call.
-#
do_exec_tests
return 0