+Sun Oct 17 02:06:01 1993 Stu Grossman (grossman at cygnus.com)
+
+ * procfs.c: Handle process exits more elegantly by trapping on
+ entry to _exit. Also, cleanup procinfo list when process dies of
+ it's own accord (as opposed to being killed).
+
Sat Oct 16 20:47:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* config/m88k/xm-dgux.h: Define NO_PTRACE_H.
print_sys_errmsg (pi->pathname, errno);
error ("PIOCWSTOP failed");
}
+ pi->had_event = 1;
#endif
if (attach_flag)
static void
procfs_kill_inferior ()
{
- struct procinfo *pi;
-
- for (pi = procinfo_list; pi; pi = pi->next)
- unconditionally_kill_inferior (pi);
-
target_mourn_inferior ();
}
proc_set_exec_trap ()
{
sysset_t exitset;
+ sysset_t entryset;
auto char procname[32];
int fd;
_exit (127);
}
premptyset (&exitset);
+ premptyset (&entryset);
/* GW: Rationale...
Not all systems with /proc have all the exec* syscalls with the same
praddset (&exitset, SYS_execve);
#endif
#ifdef SYS_execv
- praddset(&exitset, SYS_execv);
+ praddset (&exitset, SYS_execv);
#endif
if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
_exit (127);
}
+ praddset (&entryset, SYS_exit);
+
+ if (ioctl (fd, PIOCSENTRY, &entryset) < 0)
+ {
+ perror (procname);
+ fflush (stderr);
+ _exit (126);
+ }
+
/* Turn off inherit-on-fork flag so that all grand-children of gdb
start with tracing flags cleared. */
{
case PR_SIGNALLED:
statval = (what << 8) | 0177;
+ break;
+ case PR_SYSENTRY:
+ if (what != SYS_exit)
+ error ("PR_SYSENTRY, unknown system call %d", what);
+
+ pi->prrun.pr_flags = PRCFAULT;
+
+ if (ioctl (pi->fd, PIOCRUN, &pi->prrun) != 0)
+ perror_with_name (pi->pathname);
+
+ rtnval = wait (&statval);
+
break;
case PR_SYSEXIT:
switch (what)
static void
procfs_mourn_inferior ()
{
+ struct procinfo *pi;
+
+ for (pi = procinfo_list; pi; pi = pi->next)
+ unconditionally_kill_inferior (pi);
+
unpush_target (&procfs_ops);
generic_mourn_inferior ();
}