From 2cb973527e6c5121cb53d97e1059f765f69ae052 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 16 Nov 2021 16:46:43 +0100 Subject: [PATCH] [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 1f28b70def1 "[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp"). Remove the inferior output, and revert commit 1f28b70def1 to make the matching more restrictive. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/foll-vfork-exit.c | 4 ++-- gdb/testsuite/gdb.base/foll-vfork.c | 3 +-- gdb/testsuite/gdb.base/foll-vfork.exp | 14 +++++++------- gdb/testsuite/gdb.base/vforked-prog.c | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c index 6c263cdc057..a0509d57991 100644 --- a/gdb/testsuite/gdb.base/foll-vfork-exit.c +++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c @@ -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; diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c index 2f6661d1a0b..2385447dbc4 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.c +++ b/gdb/testsuite/gdb.base/foll-vfork.c @@ -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"; } } diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index 5de0795d60a..41208c2fe9c 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -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 } } diff --git a/gdb/testsuite/gdb.base/vforked-prog.c b/gdb/testsuite/gdb.base/vforked-prog.c index 936c6e6032d..6542f1d8583 100644 --- a/gdb/testsuite/gdb.base/vforked-prog.c +++ b/gdb/testsuite/gdb.base/vforked-prog.c @@ -19,6 +19,6 @@ int main (void) { - printf("Hello from vforked-prog...\n"); + const char *volatile s = "Hello from vforked-prog"; return 0; } -- 2.30.2