Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
/* Fork a Unix child process, and set up to debug it, for GDB.
|
* README: Remove note about gcc warnings on alpha, these should be
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
1994-02-08 09:01:03 +00:00
|
|
|
Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
Contributed by Cygnus Support.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
* README: Remove note about gcc warnings on alpha, these should be
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
1994-02-08 09:01:03 +00:00
|
|
|
#include <string.h>
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
#include "frame.h" /* required by inferior.h */
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "wait.h"
|
|
|
|
#include "gdbcore.h"
|
1993-10-09 00:00:56 +00:00
|
|
|
#include "terminal.h"
|
* Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
which no longer occur.
gcc -Wall lint:
* findvar.c (symbol_read_needs_frame), corelow.c (ignore),
inflow.c (gdb_has_a_terminal): Make sure to return a value.
* regex.h: Declare re_set_syntax.
* printcmd.c: Include valprint.h.
* infcmd.c, exec.c, maint.c, core.c: Include language.h.
* maint.c: Include expression.h.
* infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
* inftarg.c: Include command.h.
* coredep.c: Include value.h.
* c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
* ch-typeprint.c: Include typeprint.h.
* ch-valprint.c: Include c-lang.h.
* nlmread.c: Include buildsym.h.
* environ.c: Include gdbcore.h. Only include defs.h once.
(set_in_environ): Cast const char * to char * when passing to
set_gnutarget.
Remove unused variables:
* printcmd.c (printf_command): args_to_vprintf.
* coffread.c (coff_symfile_init): strsection.
Move variables to within the #ifdefs where they are used:
* symtab.c (gdb_mangle_name): opname.
* inftarg.c (child_attach): pid and exec_file.
* inftarg.c (child_detach): siggnal.
* objfiles.c (allocate_objfile): mapto, md, and fd.
* objfiles.c (free_objfile): mmfd.
* infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
* infrun.c (wait_for_inferior): Remove unused same_pid label.
* inferior.h: Declare set_sigint_trap and clear_sigint_trap.
* parser-defs.h: Declare write_exp_elt_block.
* stabsread.h: Declare elfstab_offset_sections and
coffstab_build_psymtabs.
1993-10-21 20:41:50 +00:00
|
|
|
#include "thread.h"
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
extern char **environ;
|
|
|
|
|
|
|
|
#ifndef SHELL_FILE
|
|
|
|
#define SHELL_FILE "/bin/sh"
|
|
|
|
#endif
|
|
|
|
|
1994-01-22 17:36:41 +00:00
|
|
|
/* Start an inferior Unix child process and sets inferior_pid to its pid.
|
|
|
|
EXEC_FILE is the file to run.
|
|
|
|
ALLARGS is a string containing the arguments to the program.
|
|
|
|
ENV is the environment vector to pass. SHELL_FILE is the shell file,
|
|
|
|
or NULL if we should pick one. Errors reported with error(). */
|
|
|
|
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
void
|
1994-01-22 17:36:41 +00:00
|
|
|
fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun,
|
|
|
|
shell_file)
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
char *exec_file;
|
|
|
|
char *allargs;
|
|
|
|
char **env;
|
|
|
|
void (*traceme_fun) PARAMS ((void));
|
|
|
|
void (*init_trace_fun) PARAMS ((int));
|
1994-01-22 17:36:41 +00:00
|
|
|
char *shell_file;
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
{
|
|
|
|
int pid;
|
|
|
|
char *shell_command;
|
|
|
|
static char default_shell_file[] = SHELL_FILE;
|
|
|
|
int len;
|
|
|
|
/* 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
|
|
|
|
to you in the parent process. It's only used by humans for debugging. */
|
|
|
|
static int debug_setpgrp = 657473;
|
|
|
|
char **save_our_env;
|
|
|
|
|
|
|
|
/* If no exec file handed to us, get it from the exec-file command -- with
|
|
|
|
a good, common error message if none is specified. */
|
|
|
|
if (exec_file == 0)
|
|
|
|
exec_file = get_exec_file(1);
|
|
|
|
|
|
|
|
/* The user might want tilde-expansion, and in general probably wants
|
|
|
|
the program to behave the same way as if run from
|
|
|
|
his/her favorite shell. So we let the shell run it for us.
|
1993-11-02 23:55:19 +00:00
|
|
|
FIXME-maybe, we might want a "set shell" command so the user can change
|
1994-01-22 17:36:41 +00:00
|
|
|
the shell from within GDB (if so, change callers which pass in a non-NULL
|
|
|
|
shell_file too). */
|
|
|
|
if (shell_file == NULL)
|
|
|
|
shell_file = getenv ("SHELL");
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
if (shell_file == NULL)
|
|
|
|
shell_file = default_shell_file;
|
1993-06-22 04:27:00 +00:00
|
|
|
|
|
|
|
/* Multiplying the length of exec_file by 4 is to account for the fact
|
|
|
|
that it may expand when quoted; it is a worst-case number based on
|
|
|
|
every character being '. */
|
|
|
|
len = 5 + 4 * strlen (exec_file) + 1 + strlen (allargs) + 1 + /*slop*/ 12;
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
/* If desired, concat something onto the front of ALLARGS.
|
|
|
|
SHELL_COMMAND is the result. */
|
|
|
|
#ifdef SHELL_COMMAND_CONCAT
|
|
|
|
shell_command = (char *) alloca (strlen (SHELL_COMMAND_CONCAT) + len);
|
|
|
|
strcpy (shell_command, SHELL_COMMAND_CONCAT);
|
|
|
|
#else
|
|
|
|
shell_command = (char *) alloca (len);
|
|
|
|
shell_command[0] = '\0';
|
|
|
|
#endif
|
|
|
|
strcat (shell_command, "exec ");
|
1993-06-22 04:27:00 +00:00
|
|
|
|
1993-07-27 17:43:09 +00:00
|
|
|
/* Now add exec_file, quoting as necessary. */
|
1993-06-22 04:27:00 +00:00
|
|
|
{
|
|
|
|
char *p;
|
1993-07-27 17:43:09 +00:00
|
|
|
int need_to_quote;
|
1993-06-22 04:27:00 +00:00
|
|
|
|
1993-07-27 17:43:09 +00:00
|
|
|
/* Quoting in this style is said to work with all shells. But csh
|
|
|
|
on IRIX 4.0.1 can't deal with it. So we only quote it if we need
|
|
|
|
to. */
|
|
|
|
p = exec_file;
|
|
|
|
while (1)
|
1993-06-22 04:27:00 +00:00
|
|
|
{
|
1993-07-27 17:43:09 +00:00
|
|
|
switch (*p)
|
|
|
|
{
|
|
|
|
case '\'':
|
|
|
|
case '"':
|
|
|
|
case '(':
|
|
|
|
case ')':
|
|
|
|
case '$':
|
|
|
|
case '&':
|
|
|
|
case ';':
|
|
|
|
case '<':
|
|
|
|
case '>':
|
|
|
|
case ' ':
|
|
|
|
case '\n':
|
|
|
|
case '\t':
|
|
|
|
need_to_quote = 1;
|
|
|
|
goto end_scan;
|
|
|
|
|
|
|
|
case '\0':
|
|
|
|
need_to_quote = 0;
|
|
|
|
goto end_scan;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++p;
|
1993-06-22 04:27:00 +00:00
|
|
|
}
|
1993-07-27 17:43:09 +00:00
|
|
|
end_scan:
|
|
|
|
if (need_to_quote)
|
|
|
|
{
|
|
|
|
strcat (shell_command, "'");
|
|
|
|
for (p = exec_file; *p != '\0'; ++p)
|
|
|
|
{
|
|
|
|
if (*p == '\'')
|
|
|
|
strcat (shell_command, "'\\''");
|
|
|
|
else
|
|
|
|
strncat (shell_command, p, 1);
|
|
|
|
}
|
|
|
|
strcat (shell_command, "'");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strcat (shell_command, exec_file);
|
1993-06-22 04:27:00 +00:00
|
|
|
}
|
|
|
|
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
strcat (shell_command, " ");
|
|
|
|
strcat (shell_command, allargs);
|
|
|
|
|
|
|
|
/* exec is said to fail if the executable is open. */
|
|
|
|
close_exec_file ();
|
|
|
|
|
|
|
|
/* Retain a copy of our environment variables, since the child will
|
|
|
|
replace the value of environ and if we're vforked, we have to
|
|
|
|
restore it. */
|
|
|
|
save_our_env = environ;
|
|
|
|
|
|
|
|
/* Tell the terminal handling subsystem what tty we plan to run on;
|
|
|
|
it will just record the information for later. */
|
|
|
|
|
|
|
|
new_tty_prefork (inferior_io_terminal);
|
|
|
|
|
|
|
|
/* It is generally good practice to flush any possible pending stdio
|
|
|
|
output prior to doing a fork, to avoid the possibility of both the
|
|
|
|
parent and child flushing the same data after the fork. */
|
|
|
|
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stdout);
|
|
|
|
gdb_flush (gdb_stderr);
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
|
|
|
|
#if defined(USG) && !defined(HAVE_VFORK)
|
|
|
|
pid = fork ();
|
|
|
|
#else
|
|
|
|
if (debug_fork)
|
|
|
|
pid = fork ();
|
|
|
|
else
|
|
|
|
pid = vfork ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pid < 0)
|
|
|
|
perror_with_name ("vfork");
|
|
|
|
|
|
|
|
if (pid == 0)
|
|
|
|
{
|
|
|
|
if (debug_fork)
|
|
|
|
sleep (debug_fork);
|
|
|
|
|
|
|
|
/* Run inferior in a separate process group. */
|
* inftarg.c: Remove unused include of terminal.h.
* signals.h: Don't undefine signals anymore.
* main.c: Use job_control from serial.h.
* fork-child.c (fork_inferior): Use gdb_setpgid.
* serial.h, ser-unix.c, ser-go32.c: Provide gdb_setpgid.
* utils.c (quit): Use current_target->to_terminal_ours to figure
out whether we care about lack of job control, rather than __GO32__.
* utils.c: Include serial.h not terminal.h
(quit): Use job_control not TIOCGPGRP.
* terminal.h: Don't undefine TIOCGPGRP.
* serial.h, ser-unix.c, ser-go32.c, ser-tcp.c: Add SERIAL_FLUSH_OUTPUT.
* utils.c (quit): Use it.
* serial.h: Add SERIAL_UN_FDOPEN.
* utils.c (quit): Use it.
* ser-unix.c: Add process group to ttystate.
[HAVE_SGTTY]: Add tchars, ltchars, and lmode to ttystate.
* inflow.c: Include serial.h not terminal.h.
Use serial.h stuff to replace most of the maze of #ifdef's.
* inflow.c, main.c, inferior.h: make gdb_has_a_terminal a function.
* serial.h: Document SERIAL_SET_TTY_STATE as being immediate.
* ser-unix.c: Use TIOCSETN not TIOCSETP so it is true.
* serial.h, ser-unix.c, ser-go32.c, ser-tcp.c:
Add SERIAL_PRINT_TTY_STATE, SERIAL_NOFLUSH_SET_TTY_STATE, and
SERIAL_SET_PROCESS_GROUP.
* inflow.c: Use them.
* config/xm-svr4.h, config/rs6000/xm-rs6000.h, config/sparc/sun4os4.h:
Define HAVE_TERMIOS.
* Various: Remove all use of TIOC*_BROKEN.
1993-06-30 22:20:53 +00:00
|
|
|
debug_setpgrp = gdb_setpgid ();
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
if (debug_setpgrp == -1)
|
|
|
|
perror("setpgrp failed in child");
|
|
|
|
|
|
|
|
/* Ask the tty subsystem to switch to the one we specified earlier
|
|
|
|
(or to share the current terminal, if none was specified). */
|
|
|
|
|
|
|
|
new_tty ();
|
|
|
|
|
|
|
|
/* Changing the signal handlers for the inferior after
|
|
|
|
a vfork can also change them for the superior, so we don't mess
|
|
|
|
with signals here. See comments in
|
|
|
|
initialize_signals for how we get the right signal handlers
|
|
|
|
for the inferior. */
|
|
|
|
|
|
|
|
/* "Trace me, Dr. Memory!" */
|
|
|
|
(*traceme_fun) ();
|
|
|
|
|
|
|
|
/* There is no execlpe call, so we have to set the environment
|
|
|
|
for our child in the global variable. If we've vforked, this
|
|
|
|
clobbers the parent, but environ is restored a few lines down
|
|
|
|
in the parent. By the way, yes we do need to look down the
|
|
|
|
path to find $SHELL. Rich Pixley says so, and I agree. */
|
|
|
|
environ = env;
|
|
|
|
execlp (shell_file, shell_file, "-c", shell_command, (char *)0);
|
|
|
|
|
1993-11-01 22:25:23 +00:00
|
|
|
fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
safe_strerror (errno));
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stderr);
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
_exit (0177);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore our environment in case a vforked child clob'd it. */
|
|
|
|
environ = save_our_env;
|
|
|
|
|
1993-10-16 06:42:02 +00:00
|
|
|
init_thread_list();
|
|
|
|
|
1993-10-27 19:30:27 +00:00
|
|
|
inferior_pid = pid; /* Needed for wait_for_inferior stuff below */
|
|
|
|
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
/* Now that we have a child process, make it our target, and
|
|
|
|
initialize anything target-vector-specific that needs initializing. */
|
|
|
|
(*init_trace_fun)(pid);
|
|
|
|
|
1993-10-27 19:30:27 +00:00
|
|
|
/* 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;
|
|
|
|
|
1993-10-15 04:26:06 +00:00
|
|
|
/* 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. */
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
|
|
|
|
clear_proceed_status ();
|
|
|
|
|
|
|
|
init_wait_for_inferior ();
|
|
|
|
|
1993-09-30 20:41:17 +00:00
|
|
|
terminal_initted = 0;
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
|
1994-06-16 23:04:55 +00:00
|
|
|
#ifdef STARTUP_INFERIOR
|
|
|
|
STARTUP_INFERIOR (pending_execs);
|
|
|
|
#else
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
stop_soon_quietly = 1; /* Make wait_for_inferior be quiet */
|
|
|
|
wait_for_inferior ();
|
* target.h: Add enum target_waitkind, enum target_signal, and
struct target_waitstatus. Change status argument to target_wait to
be struct target_waitstatus * instead of int *.
* target.h, infrun.c, all targets: Change type of signal arguments
to resume(), proceed(), and target_resume() from int to enum
target_signal.
* All targets (*_wait, *_resume): Change accordingly.
* infcmd.c (program_info, signal_command), throughout infrun.c,
* fork-child.c, solib.c, hppa-tdep.c, osfsolib.c: Use this stuff.
* convex-xdep.c, convex-tdep.c: Add FIXME's (getting the Convex
signal code stuff right with the new signals would be non-trivial).
* inferior.h (stop_signal): Make it enum target_signal not int.
* target.c, target.h (target_signal_to_string, target_signal_to_name,
target_signal_from_name): New functions.
* inftarg.c, target.h (target_signal_to_host, target_signal_from_host,
store_waitstatus): New functions.
* procfs.c (procfs_notice_signals): Use them.
* i960-tdep.c (i960_fault_to_signal): New function, to replace
print_fault.
* config/i960/tm-i960.h: Don't define PRINT_RANDOM_SIGNAL.
1994-01-04 21:53:53 +00:00
|
|
|
if (stop_signal != TARGET_SIGNAL_TRAP)
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
{
|
|
|
|
/* Let shell child handle its own signals in its own way */
|
|
|
|
/* FIXME, what if child has exit()ed? Must exit loop somehow */
|
|
|
|
resume (0, stop_signal);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We handle SIGTRAP, however; it means child did an exec. */
|
1993-09-30 20:41:17 +00:00
|
|
|
if (!terminal_initted)
|
|
|
|
{
|
|
|
|
/* Now that the child has exec'd we know it has already set its
|
|
|
|
process group. On POSIX systems, tcsetpgrp will fail with
|
|
|
|
EPERM if we try it before the child's setpgid. */
|
|
|
|
|
|
|
|
/* Set up the "saved terminal modes" of the inferior
|
|
|
|
based on what modes we are starting it with. */
|
|
|
|
target_terminal_init ();
|
|
|
|
|
|
|
|
/* Install inferior's terminal modes. */
|
|
|
|
target_terminal_inferior ();
|
|
|
|
|
|
|
|
terminal_initted = 1;
|
|
|
|
}
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
if (0 == --pending_execs)
|
|
|
|
break;
|
* target.h: Add enum target_waitkind, enum target_signal, and
struct target_waitstatus. Change status argument to target_wait to
be struct target_waitstatus * instead of int *.
* target.h, infrun.c, all targets: Change type of signal arguments
to resume(), proceed(), and target_resume() from int to enum
target_signal.
* All targets (*_wait, *_resume): Change accordingly.
* infcmd.c (program_info, signal_command), throughout infrun.c,
* fork-child.c, solib.c, hppa-tdep.c, osfsolib.c: Use this stuff.
* convex-xdep.c, convex-tdep.c: Add FIXME's (getting the Convex
signal code stuff right with the new signals would be non-trivial).
* inferior.h (stop_signal): Make it enum target_signal not int.
* target.c, target.h (target_signal_to_string, target_signal_to_name,
target_signal_from_name): New functions.
* inftarg.c, target.h (target_signal_to_host, target_signal_from_host,
store_waitstatus): New functions.
* procfs.c (procfs_notice_signals): Use them.
* i960-tdep.c (i960_fault_to_signal): New function, to replace
print_fault.
* config/i960/tm-i960.h: Don't define PRINT_RANDOM_SIGNAL.
1994-01-04 21:53:53 +00:00
|
|
|
resume (0, TARGET_SIGNAL_0); /* Just make it go on */
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
}
|
|
|
|
}
|
1994-06-16 23:04:55 +00:00
|
|
|
#endif /* STARTUP_INFERIOR */
|
Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior): New global function from fork-child.c.
* inftarg.c (child_wait): Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him): New stub functions for fork_inferior().
(child_create_inferior): Moved to fork-child.c as fork_inferior.
(child_create_inferior): New tiny function that calls fork_inferior.
* fork-child.c: New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.
* procfs.c (procfs_ops): Add target vector.
(attach): Rename as static do_attach.
(procfs_create_inferior): New tiny function that calls fork_inferior.
(child_xfer_memory): Rename to static procfs_xfer_memory.
(store_inferior_registers): Rename to static procfs_store_registers.
(inferior_proc_init): Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run): Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait): Renamed to static procfs_wait.
(child_resume): Rename to static procfs_resume.
(fetch_inferior_registers): Rename to static procfs_fetch_registers.
(initialize_proc_fs): Rename to initialize_procfs. Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK): No longer needed.
1992-09-26 09:06:30 +00:00
|
|
|
stop_soon_quietly = 0;
|
|
|
|
}
|