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;
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";
}
}
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"
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 {
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 {
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 " {
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
}
}