gdb/
2009-05-17 Pedro Alves <pedro@codesourcery.com> * infrun.c (handle_inferior_event): When handling a TARGET_WAITKIND_FORKED, detach breakpoints from the fork child immediatelly. * linux-nat.c (linux_child_follow_fork): Only detach breakpoint from the child if vforking. * inf-ptrace.c (inf_ptrace_follow_fork): No need to detach breakpoints from the child here. gdb/testsuite/ 2009-05-17 Pedro Alves <pedro@codesourcery.com> * gdb.base/foll-fork.c: Include stdlib.h. Add markers for `gdb_get_line_number'. Call `callee' in both parent and child. * gdb.base/foll-fork.exp (catch_fork_child_follow): Use `gdb_get_line_number' instead of hardcoding line numbers. (catch_fork_unpatch_child): New procedure to test detaching breakpoints from child fork. (tcatch_fork_parent_follow): Use `gdb_get_line_number' instead of hardcoding line numbers. (do_fork_tests): Run `catch_fork_unpatch_child'.
This commit is contained in:
parent
235f2b04ae
commit
b242c3c237
7 changed files with 126 additions and 18 deletions
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef PROTOTYPES
|
||||
void callee (int i)
|
||||
|
@ -21,14 +22,18 @@ main ()
|
|||
int v = 5;
|
||||
|
||||
pid = fork ();
|
||||
if (pid == 0)
|
||||
if (pid == 0) /* set breakpoint here */
|
||||
{
|
||||
v++;
|
||||
/* printf ("I'm the child!\n"); */
|
||||
callee (getpid ());
|
||||
}
|
||||
else
|
||||
{
|
||||
v--;
|
||||
/* printf ("I'm the proud parent of child #%d!\n", pid); */
|
||||
callee (getpid ());
|
||||
}
|
||||
|
||||
exit (0); /* at exit */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue