create_procinfo (pid);
add_thread (pid); /* Setup initial thread */
+
+ /* One trap to exec the shell, one to exec the program being debugged. */
+ startup_inferior (2);
}
/*
for (signo = 0; signo < NSIG; signo++)
{
- if (signal_stop_state (signo) == 0 &&
- signal_print_state (signo) == 0 &&
- signal_pass_state (signo) == 1)
+ if (signal_stop_state (target_signal_from_host (signo)) == 0 &&
+ signal_print_state (target_signal_from_host (signo)) == 0 &&
+ signal_pass_state (target_signal_from_host (signo)) == 1)
{
prdelset (&pi->prrun.pr_trace, signo);
}
if ((fd = open (procname, O_RDWR)) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
premptyset (&exitset);
if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
if (ioctl (fd, PIOCSENTRY, &entryset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (126);
}
exec_file = (char *) get_exec_file (0);
if (exec_file)
- printf ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
else
- printf ("Attaching to %s\n", target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
do_attach (pid);
char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
- printf ("Detaching from program: %s %s\n",
+ printf_unfiltered ("Detaching from program: %s %s\n",
exec_file, target_pid_to_str (inferior_pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (args)
siggnal = atoi (args);
procfs_files_info (ignore)
struct target_ops *ignore;
{
- printf ("\tUsing the running image of %s %s via /proc.\n",
+ printf_unfiltered ("\tUsing the running image of %s %s via /proc.\n",
attach_flag? "attached": "child", target_pid_to_str (inferior_pid));
}
}
else
{
- printf ("Ok, gdb will wait for %s to stop.\n", target_pid_to_str (pid));
+ printf_unfiltered ("Ok, gdb will wait for %s to stop.\n", target_pid_to_str (pid));
}
}
if (ioctl (pi->fd, PIOCSEXIT, &pi->saved_exitset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSEXIT failed.\n");
+ printf_unfiltered ("PIOCSEXIT failed.\n");
}
if (ioctl (pi->fd, PIOCSENTRY, &pi->saved_entryset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSENTRY failed.\n");
+ printf_unfiltered ("PIOCSENTRY failed.\n");
}
if (ioctl (pi->fd, PIOCSTRACE, &pi->saved_trace) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSTRACE failed.\n");
+ printf_unfiltered ("PIOCSTRACE failed.\n");
}
if (ioctl (pi->fd, PIOCSHOLD, &pi->saved_sighold) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOSCHOLD failed.\n");
+ printf_unfiltered ("PIOSCHOLD failed.\n");
}
if (ioctl (pi->fd, PIOCSFAULT, &pi->saved_fltset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSFAULT failed.\n");
+ printf_unfiltered ("PIOCSFAULT failed.\n");
}
if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSTATUS failed.\n");
+ printf_unfiltered ("PIOCSTATUS failed.\n");
}
else
{
if (ioctl (pi->fd, PIOCCFAULT, 0))
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCCFAULT failed.\n");
+ printf_unfiltered ("PIOCCFAULT failed.\n");
}
/* Make it run again when we close it. */
if (result)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSRLC or PIOCSET failed.\n");
+ printf_unfiltered ("PIOCSRLC or PIOCSET failed.\n");
}
}
}
static int
procfs_wait (pid, statloc)
int pid;
- int *statloc;
+ struct target_waitstatus *ourstatus;
{
short what;
short why;
pi->prstatus.pr_flags);
}
- if (statloc)
- {
- *statloc = statval;
- }
+ store_waitstatus (ourstatus, statval);
if (rtnval == -1) /* No more children to wait for */
{
- fprintf (stderr, "Child process unexpectedly missing.\n");
- *statloc = 42; /* Claim it exited with signal 42 */
+ fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing.\n");
+ /* Claim it exited with unknown signal. */
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return rtnval;
}
procfs_resume (pid, step, signo)
int pid;
int step;
- int signo;
+ enum target_signal signo;
{
int signal_to_pass;
struct procinfo *pi, *procinfo;
#endif
#endif
- if (signo == SIGSTOP && pi->nopass_next_sigstop)
+ if (signo == TARGET_SIGNAL_STOP && pi->nopass_next_sigstop)
/* When attaching to a child process, if we forced it to stop with
a PIOCSTOP, then we will have set the nopass_next_sigstop flag.
Upon resuming the first time after such a stop, we explicitly
deal with the inferior a little smarter, and possibly even allow
an inferior to continue running at the same time as gdb. (FIXME?) */
signal_to_pass = 0;
- else if (signo == SIGTSTP
+ else if (signo == TARGET_SIGNAL_TSTP
&& pi->prstatus.pr_cursig == SIGTSTP
&& pi->prstatus.pr_action.sa_handler == SIG_DFL)
because the handler needs to get executed. */
signal_to_pass = 0;
else
- signal_to_pass = signo;
+ signal_to_pass = target_signal_to_host (signo);
if (signal_to_pass)
{
{
if (ioctl (procinfo->fd, PIOCSTATUS, &procinfo->prstatus) < 0)
{
- fprintf(stderr, "PIOCSTATUS failed, errno=%d\n", errno);
+ fprintf_unfiltered(gdb_stderr, "PIOCSTATUS failed, errno=%d\n", errno);
}
print_sys_errmsg (procinfo->pathname, errno);
error ("PIOCRUN failed");
procfs_set_sproc_trap (current_procinfo);
#endif
- proceed ((CORE_ADDR) -1, 0, 0);
+ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
/* Clean up after the inferior dies. */