aboutsummaryrefslogtreecommitdiff
path: root/gdb/fork-child.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-10-27 19:30:27 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-10-27 19:30:27 +0000
commitbc28a06cc11e2be1d9bd4f4233b3fbbe5ff30654 (patch)
tree78be5c33ffe139db5abfe818092ba4f914087b0b /gdb/fork-child.c
parent73e7e44744ba0bdfc3e4ab2822a5a818aa993e07 (diff)
downloadgdb-bc28a06cc11e2be1d9bd4f4233b3fbbe5ff30654.zip
gdb-bc28a06cc11e2be1d9bd4f4233b3fbbe5ff30654.tar.gz
gdb-bc28a06cc11e2be1d9bd4f4233b3fbbe5ff30654.tar.bz2
* fork-child.c (fork_inferior): Set inferior_pid before calling
init_trace_fun. Move the code which gets us through the shell to new function startup_inferior. * inferior.h: Declare startup_inferior. * procfs.c (procfs_init_inferior), inftarg.c (ptrace_him): Call startup_inferior. * m3-nat.c (m3_trace_him): Call intercept_exec_calls. * config/nm-m3.h: Don't define STARTUP_INFERIOR. * config/i386/tm-i386m3.h, config/ns32k/tm-ns32k.h, config/mips/tm-mipsm3.h: Don't define START_INFERIOR_TRAPS_EXPECTED.
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r--gdb/fork-child.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index e5a16c5..62c7a3a 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -60,8 +60,6 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
char *shell_file;
static char default_shell_file[] = SHELL_FILE;
int len;
- int pending_execs;
- int terminal_initted;
/* Set debug_fork then attach to the child while it sleeps, to debug. */
static int debug_fork = 0;
/* This is set to the result of setpgrp, which if vforked, will be visible
@@ -241,28 +239,35 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
init_thread_list();
+ inferior_pid = pid; /* Needed for wait_for_inferior stuff below */
+
/* Now that we have a child process, make it our target, and
initialize anything target-vector-specific that needs initializing. */
(*init_trace_fun)(pid);
+ /* We are now in the child process of interest, having exec'd the
+ correct program, and are poised at the first instruction of the
+ new program. */
+#ifdef SOLIB_CREATE_INFERIOR_HOOK
+ SOLIB_CREATE_INFERIOR_HOOK (pid);
+#endif
+}
+
+/* Accept NTRAPS traps from the inferior. */
+
+void
+startup_inferior (ntraps)
+ int ntraps;
+{
+ int pending_execs = ntraps;
+ int terminal_initted;
+
/* The process was started by the fork that created it,
but it will have stopped one instruction after execing the shell.
Here we must get it up to actual execution of the real program. */
- inferior_pid = pid; /* Needed for wait_for_inferior stuff below */
-
clear_proceed_status ();
- /* We will get a trace trap after one instruction.
- Continue it automatically. Eventually (after shell does an exec)
- it will get another trace trap. Then insert breakpoints and continue. */
-
-#ifdef START_INFERIOR_TRAPS_EXPECTED
- pending_execs = START_INFERIOR_TRAPS_EXPECTED;
-#else
- pending_execs = 2;
-#endif
-
init_wait_for_inferior ();
terminal_initted = 0;
@@ -301,11 +306,4 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
}
}
stop_soon_quietly = 0;
-
- /* We are now in the child process of interest, having exec'd the
- correct program, and are poised at the first instruction of the
- new program. */
-#ifdef SOLIB_CREATE_INFERIOR_HOOK
- SOLIB_CREATE_INFERIOR_HOOK (pid);
-#endif
}