Eliminate literal line numbers in foll-exec.exp

Remove literal line numbers from the regexps in foll-exec.exp.  Add
appropriate eye-catchers to foll-exec.c and execd-proc.c and refer to
those instead.

gdb/testsuite/ChangeLog:

	* gdb.base/execd-prog.c: Add eye-catchers.
	* gdb.base/foll-exec.c: Likewise.
	* gdb.base/foll-exec.exp: Refer to eye-catchers instead of literal
	line numbers.
This commit is contained in:
Andreas Arnez 2014-10-24 11:04:56 +00:00 committed by Andreas Krebbel
parent 04e5059ba6
commit 58fa2af0b3
4 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2014-11-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.base/execd-prog.c: Add eye-catchers.
* gdb.base/foll-exec.c: Likewise.
* gdb.base/foll-exec.exp: Refer to eye-catchers instead of literal
line numbers.
2014-11-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.base/ending-run.c: Add eye-catchers.

View File

@ -20,7 +20,7 @@ main (argc, argv)
should not be able to see that other definition of local_j
after we are exec'd.
*/
int local_j = argc;
int local_j = argc; /* after-exec */
char * s;
printf ("Hello from execd-prog...\n");

View File

@ -24,7 +24,7 @@ main ()
printf ("foll-exec is about to execl(execd-prog)...\n");
execl (BASEDIR "/execd-prog",
execl (BASEDIR "/execd-prog", /* tbreak-execl */
BASEDIR "/execd-prog",
"execl arg1 from foll-exec",
"execl arg2 from foll-exec",
@ -38,6 +38,6 @@ main ()
printf ("foll-exec is about to execv(execd-prog)...\n");
execv (BASEDIR "/execd-prog", argv);
execv (BASEDIR "/execd-prog", argv); /* tbreak-execv */
}
}

View File

@ -119,7 +119,7 @@ proc do_exec_tests {} {
#
send_gdb "next 3\n"
gdb_expect {
-re "20.*execlp.*$gdb_prompt $"\
-re "execlp \\(.*$gdb_prompt $"\
{pass "step to exec call"}
-re "$gdb_prompt $" {fail "step to exec call"}
timeout {fail "(timeout) step to exec call"}
@ -149,9 +149,10 @@ proc do_exec_tests {} {
# Try stepping through an execlp call, without catching it.
# We should stop in execd-program, at its first statement.
#
set execd_line [gdb_get_line_number "after-exec" $srcfile2]
send_gdb "next\n"
gdb_expect {
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execlp call"}
-re "$gdb_prompt $" {fail "step through execlp call"}
timeout {fail "(timeout) step through execlp call"}
@ -162,7 +163,7 @@ proc do_exec_tests {} {
#
send_gdb "next\n"
gdb_expect {
-re "26.*printf.*$gdb_prompt $"\
-re "printf \\(.Hello .*$gdb_prompt $"\
{pass "step after execlp call"}
-re "$gdb_prompt $" {fail "step after execlp call"}
timeout {fail "(timeout) step after execlp call"}
@ -256,7 +257,7 @@ proc do_exec_tests {} {
#
send_gdb "continue\n"
gdb_expect {
-re ".*${srcfile2}:23.*$gdb_prompt $"\
-re ".*${srcfile2}:${execd_line}.*$gdb_prompt $"\
{pass "continue after hit catch exec"}
-re "$gdb_prompt $" {fail "continue after hit catch exec"}
timeout {fail "(timeout) continue after hit catch exec"}
@ -276,16 +277,17 @@ proc do_exec_tests {} {
# Verify that we can follow through follow an execl()
# call. (We must jump around earlier exec* calls.)
#
send_gdb "tbreak 27\n"
set tbreak_line [gdb_get_line_number "tbreak-execl" $srcfile]
send_gdb "tbreak ${tbreak_line}\n"
gdb_expect {
-re "Temporary breakpoint .*file .*${srcfile}, line 27.*$gdb_prompt $"\
-re "Temporary breakpoint .*file .*${srcfile}, line ${tbreak_line}.*$gdb_prompt $"\
{pass "prepare to jump to execl call"}
-re "$gdb_prompt $" {fail "prepare to jump to execl call"}
timeout {fail "(timeout) prepare to jump to execl call"}
}
send_gdb "jump 27\n"
send_gdb "jump ${tbreak_line}\n"
gdb_expect {
-re "main.* at .*${srcfile}:27.*$gdb_prompt $"\
-re "main.* at .*${srcfile}:${tbreak_line}.*$gdb_prompt $"\
{pass "jump to execl call"}
-re "$gdb_prompt $" {fail "jump to execl call"}
timeout {fail "(timeout) jump to execl call"}
@ -298,14 +300,14 @@ proc do_exec_tests {} {
#
send_gdb "next 2\n"
gdb_expect {
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execl call"}
-re "$gdb_prompt $" {fail "step through execl call"}
timeout {fail "(timeout) step through execl call"}
}
send_gdb "next\n"
gdb_expect {
-re "26.*printf.*$gdb_prompt $"\
-re "printf \\(.Hello .*$gdb_prompt $"\
{pass "step after execl call"}
-re "$gdb_prompt $" {fail "step after execl call"}
timeout {fail "(timeout) step after execl call"}
@ -336,30 +338,31 @@ proc do_exec_tests {} {
# Verify that we can follow through follow an execv()
# call. (We must jump around earlier exec* calls.)
#
send_gdb "tbreak 41\n"
set tbreak_line [gdb_get_line_number "tbreak-execv"]
send_gdb "tbreak ${tbreak_line}\n"
gdb_expect {
-re "Temporary breakpoint .*file .*${srcfile}, line 41.*$gdb_prompt $"\
-re "Temporary breakpoint .*file .*${srcfile}, line ${tbreak_line}.*$gdb_prompt $"\
{pass "prepare to jump to execv call"}
-re "$gdb_prompt $" {fail "prepare to jump to execv call"}
timeout {fail "(timeout) prepare to jump to execv call"}
}
send_gdb "jump 41\n"
send_gdb "jump ${tbreak_line}\n"
gdb_expect {
-re "main.* at .*${srcfile}:41.*$gdb_prompt $"\
-re "main.* at .*${srcfile}:${tbreak_line}.*$gdb_prompt $"\
{pass "jump to execv call"}
-re "$gdb_prompt $" {fail "jump to execv call"}
timeout {fail "(timeout) jump to execv call"}
}
send_gdb "next\n"
gdb_expect {
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execv call"}
-re "$gdb_prompt $" {fail "step through execv call"}
timeout {fail "(timeout) step through execv call"}
}
send_gdb "next\n"
gdb_expect {
-re "26.*printf.*$gdb_prompt $"\
-re "printf \\(.Hello .*$gdb_prompt $"\
{pass "step after execv call"}
-re "$gdb_prompt $" {fail "step after execv call"}
timeout {fail "(timeout) step after execv call"}
@ -393,7 +396,7 @@ proc do_exec_tests {} {
#
send_gdb "continue\n"
gdb_expect {
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
-re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "continue through exec"}
-re "$gdb_prompt $" {fail "continue through exec"}
timeout {fail "(timeout) continue through exec"}