}
else if (pid == inf->pid)
{
- store_waitstatus (&inf->wait.status, status);
+ inf->wait.status = host_status_to_waitstatus (status);
if (inf->wait.status.kind () == TARGET_WAITKIND_STOPPED)
/* The process has sent us a signal, and stopped itself in a sane
state pending our actions. */
return inf_child_target_info;
}
-/* Helper function for child_wait and the derivatives of child_wait.
- HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
- translation of that in OURSTATUS. */
-void
-store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
+/* See inf-child.h. */
+
+target_waitstatus
+host_status_to_waitstatus (int hoststatus)
{
if (WIFEXITED (hoststatus))
- ourstatus->set_exited (WEXITSTATUS (hoststatus));
+ return target_waitstatus ().set_exited (WEXITSTATUS (hoststatus));
else if (!WIFSTOPPED (hoststatus))
- ourstatus->set_signalled (gdb_signal_from_host (WTERMSIG (hoststatus)));
+ return target_waitstatus ().set_signalled
+ (gdb_signal_from_host (WTERMSIG (hoststatus)));
else
- ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (hoststatus)));
+ return target_waitstatus ().set_stopped
+ (gdb_signal_from_host (WSTOPSIG (hoststatus)));
}
inf_child_target::~inf_child_target ()
void maybe_unpush_target ();
};
-/* Functions for helping to write a native target. */
+/* Convert the host wait(2) status to a target_waitstatus. */
-/* This is for native targets which use a unix/POSIX-style waitstatus. */
-extern void store_waitstatus (struct target_waitstatus *, int);
+extern target_waitstatus host_status_to_waitstatus (int hoststatus);
/* Register TARGET as native target and set it up to respond to the
"target native" command. */
}
while (pid == -1);
- store_waitstatus (ourstatus, status);
+ *ourstatus = host_status_to_waitstatus (status);
+
return ptid_t (pid);
}
process is gone. Store the status to report to the
core. Store it in lp->waitstatus, because lp->status
would be ambiguous (W_EXITCODE(0,0) == 0). */
- store_waitstatus (&lp->waitstatus, status);
+ lp->waitstatus = host_status_to_waitstatus (status);
return 0;
}
/* Store the pending event in the waitstatus, because
W_EXITCODE(0,0) == 0. */
- store_waitstatus (&lp->waitstatus, status);
+ lp->waitstatus = host_status_to_waitstatus (status);
return;
}
lp->waitstatus.set_ignore ();
}
else
- store_waitstatus (ourstatus, status);
+ *ourstatus = host_status_to_waitstatus (status);
linux_nat_debug_printf ("exit");
if (pid == -1)
perror_with_name (_("Child process unexpectedly missing"));
- store_waitstatus (ourstatus, status);
+ *ourstatus = host_status_to_waitstatus (status);
return pid;
}
}
if (status)
- store_waitstatus (status, wstat);
+ *status = host_status_to_waitstatus (wstat);
}
return retval;
ourstatus->set_spurious ();
/* A normal waitstatus. Let the usual macros deal with it. */
else
- store_waitstatus (ourstatus, status);
+ *ourstatus = host_status_to_waitstatus (status);
return ptid_t (pid);
}