[gdb/testsuite] Remove inferior output in gdb.base/foll-vfork.exp

Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but
which makes the regexp matching more difficult (see commit 1f28b70def
"[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp").

Remove the inferior output, and revert commit 1f28b70def to make the matching
more restrictive.

Tested on x86_64-linux.
This commit is contained in:
Tom de Vries
2021-11-16 16:46:43 +01:00
parent d7e3e62702
commit 2cb973527e
4 changed files with 11 additions and 12 deletions

View File

@@ -29,12 +29,12 @@ main ()
pid = vfork (); /* VFORK */
if (pid == 0)
{
printf ("I'm the child!\n");
const char *volatile s = "I'm the child!";
_exit (0);
}
else
{
printf ("I'm the proud parent of child #%d!\n", pid);
const char *volatile s = "I'm the proud parent of child";
}
return 0;

View File

@@ -40,12 +40,11 @@ main (int argc, char ** argv)
memcpy (prog + len - 10, "vforked-prog", 12);
prog[len + 2] = 0;
printf ("I'm the child!\n");
execlp (prog, prog, (char *) 0);
perror ("exec failed");
_exit (1);
}
else {
printf ("I'm the proud parent of child #%d!\n", pid);
const char *volatile s = "I'm the proud parent of child";
}
}

View File

@@ -119,7 +119,7 @@ proc vfork_parent_follow_to_bp {} {
gdb_test_no_output "set follow-fork parent"
set bp_location [gdb_get_line_number "printf (\"I'm the proud parent of child"]
set bp_location [gdb_get_line_number "I'm the proud parent of child"]
gdb_test "break ${srcfile}:${bp_location}" ".*" "break, vfork to bp"
set test "continue to bp"
@@ -169,7 +169,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} {
gdb_test_no_output "set follow-fork child"
set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
set test "continue to bp"
gdb_test_multiple "continue" $test {
@@ -271,7 +271,7 @@ proc tcatch_vfork_then_child_follow_exec {} {
continue_to_vfork
set linenum1 [gdb_get_line_number "pid = vfork ();"]
set linenum2 [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
set linenum2 [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
set test "finish"
gdb_test_multiple "finish" $test {
@@ -349,7 +349,7 @@ proc vfork_relations_in_info_inferiors { variant } {
if { $variant == "exec" } {
global srcfile2
set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
set test "continue to bp"
gdb_test_multiple "continue" $test {
-re ".*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " {
@@ -367,13 +367,13 @@ proc vfork_relations_in_info_inferiors { variant } {
set test "vfork relation no longer appears in info inferiors"
gdb_test_multiple "info inferiors" $test {
-re "is vfork child of inferior 1.*$gdb_prompt " {
-re -wrap "is vfork child of inferior 1.*" {
fail $test
}
-re "is vfork parent of inferior 2.*$gdb_prompt " {
-re -wrap "is vfork parent of inferior 2.*" {
fail $test
}
-re "$gdb_prompt " {
-re -wrap "" {
pass $test
}
}

View File

@@ -19,6 +19,6 @@
int main (void)
{
printf("Hello from vforked-prog...\n");
const char *volatile s = "Hello from vforked-prog";
return 0;
}