diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-11-29 08:37:14 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-11-29 08:37:14 +0000 |
commit | 3919e12ce57a6ea9e5647f4707c5dce4382a7356 (patch) | |
tree | 43e4d229fd67f3eae5cfaf1062685c764f51386a /gdb | |
parent | 1d5cce3bc9c1d27fb72e6f0cb8cfa64b927d1b5c (diff) | |
download | gdb-3919e12ce57a6ea9e5647f4707c5dce4382a7356.zip gdb-3919e12ce57a6ea9e5647f4707c5dce4382a7356.tar.gz gdb-3919e12ce57a6ea9e5647f4707c5dce4382a7356.tar.bz2 |
* fork-child.c (fork_inferior): Fork instead of vfork if
PRE_TRACE_FUN is non-null.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/fork-child.c | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f5f0574..b7c605d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-11-29 Mark Kettenis <kettenis@gnu.org> + + * fork-child.c (fork_inferior): Fork instead of vfork if + PRE_TRACE_FUN is non-null. + 2004-11-24 Fred Fish <fnf@specifixinc.com> * rs6000-tdep.c (skip_prologue): Use line table info to skip over diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 90580ba..718a3d2 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -274,10 +274,18 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, if (pre_trace_fun != NULL) (*pre_trace_fun) (); - /* Create the child process. Note that the apparent call to vfork() - below *might* actually be a call to fork() due to the fact that - autoconf will ``#define vfork fork'' on certain platforms. */ - if (debug_fork) + /* Create the child process. Since the child process is going to + exec(3) shortlty afterwards, try to reduce the overhead by + calling vfork(2). However, if PRE_TRACE_FUN is non-null, it's + likely that this optimization won't work since there's too much + work to do between the vfork(2) and the exec(3). This is known + to be the case on ttrace(2)-based HP-UX, where some handshaking + between parent and child needs to happen between fork(2) and + exec(2). However, since the parent is suspended in the vforked + state, this doesn't work. Also note that the vfork(2) call might + actually be a call to fork(2) due to the fact that autoconf will + ``#define vfork fork'' on certain platforms. */ + if (pre_trace_fun || debug_fork) pid = fork (); else pid = vfork (); |