summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-11-16 16:46:43 +0100
committerTom de Vries <tdevries@suse.de>2021-11-16 16:46:43 +0100
commit2cb973527e6c5121cb53d97e1059f765f69ae052 (patch)
tree14e9bfaf75b169b214fe581b42655b9d04ca3322
parentd7e3e627027fcf37d63e284144fe27ff4eba36b5 (diff)
downloadbinutils-gdb-2cb973527e6c5121cb53d97e1059f765f69ae052.tar.gz
[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.
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork-exit.c4
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.c3
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.exp14
-rw-r--r--gdb/testsuite/gdb.base/vforked-prog.c2
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;
}