aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-05-21 15:48:42 +0000
committerPedro Alves <palves@redhat.com>2009-05-21 15:48:42 +0000
commit47608cb1acc3880b330b8d3a8ad6aa29218046d9 (patch)
treeaa86b1ddd38ba6878b760346377a4dfebe955e1f /gdb/linux-nat.c
parent9944e9c2ac5e0e5d18eaf5100f6c57bf31cbe6e7 (diff)
downloadgdb-47608cb1acc3880b330b8d3a8ad6aa29218046d9.zip
gdb-47608cb1acc3880b330b8d3a8ad6aa29218046d9.tar.gz
gdb-47608cb1acc3880b330b8d3a8ad6aa29218046d9.tar.bz2
* target.h (TARGET_WNOHANG): New.
* target.c (target_wait): Add `options' argument. Adjust. (struct target_ops) <to_wait>: Add `options' argument. (target_wait): Add `options' argument. * infrun.c (wait_for_inferior): Pass 0 as options to target_wait (blocking wait). (fetch_inferior_event): Pass TARGET_WNOHANG as options to target_wait. * fork-child.c (startup_inferior): Pass 0 as options to target_wait (blocking wait). * linux-nat.c (linux_nat_create_inferior): Remove async masking. (linux_nat_wait_1): Add `target_options' argument. Use it instead of checking on target_can_async_p. (linux_nat_wait): Add `target_options' argument. Adjust. * remote.c (remote_wait_ns): Add `options' argument. Adjust to check on TARGET_WNOWAIT instead of checking on remote_is_async_p. (remote_wait_as): Add `options' argument. Adjust to check on TARGET_WNOWAIT instead of checking on remote_is_async_p. If doing a blocking wait, keep waiting until an interesting event comes out. (remote_wait): Add `options' argument. Don't loop here if the target is in async mode, and a blocking wait has been requested. * top.c (deprecated_target_wait_hook): Add `options' argument. * linux-thread-db.c (thread_db_wait): Add `options' argument, and pass it down to the layer beneath. * inf-ptrace.c (inf_ptrace_wait): Add `options' argument. * record.c (record_beneath_to_wait): Add `options' argument. (record_wait): Add `options' argument, and pass it down to the layer beneath. * bsd-uthread.c (bsd_uthread_wait): Add `options' argument. * darwin-nat.c (darwin_wait): Likewise. * defs.h (deprecated_target_wait_hook): Likewise. * gnu-nat.c (gnu_wait): Add `options' argument. * go32-nat.c (go32_wait): Likewise. * hpux-thread.c (hpux_thread_wait): Add `options' argument, and pass it down to the layer beneath. * inf-ttrace.c (inf_ttrace_wait): Add `options' argument. * monitor.c (monitor_wait): Likewise. * nto-procfs.c (procfs_wait): Likewise. * remote-mips.c (mips_wait): Add `options' argument. * remote-sim.c (gdbsim_wait): Likewise. * rs6000-nat.c (rs6000_wait): Add `options' argument. * sol-thread.c (sol_thread_wait): Add `options' argument, and pass it down to the layer beneath. * spu-linux-nat.c (spu_child_wait): Add `options' argument. * windows-nat.c (windows_wait): Likewise. * tui/tui-hooks.c (tui_target_wait_hook): Likewise. Adjust.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d579920..8f12587 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1341,7 +1341,6 @@ linux_nat_create_inferior (struct target_ops *ops,
char *exec_file, char *allargs, char **env,
int from_tty)
{
- int saved_async = 0;
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
@@ -1349,11 +1348,6 @@ linux_nat_create_inferior (struct target_ops *ops,
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
- if (target_can_async_p ())
- /* Mask async mode. Creating a child requires a loop calling
- wait_for_inferior currently. */
- saved_async = linux_nat_async_mask (0);
-
#ifdef HAVE_PERSONALITY
if (disable_randomization)
{
@@ -1383,9 +1377,6 @@ linux_nat_create_inferior (struct target_ops *ops,
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
-
- if (saved_async)
- linux_nat_async_mask (saved_async);
}
static void
@@ -2687,7 +2678,8 @@ linux_nat_filter_event (int lwpid, int status, int options)
static ptid_t
linux_nat_wait_1 (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus)
+ ptid_t ptid, struct target_waitstatus *ourstatus,
+ int target_options)
{
static sigset_t prev_mask;
struct lwp_info *lp = NULL;
@@ -2822,8 +2814,9 @@ retry:
set_sigint_trap ();
}
- if (target_can_async_p ())
- options |= WNOHANG; /* In async mode, don't block. */
+ /* Translate generic target_wait options into waitpid options. */
+ if (target_options & TARGET_WNOHANG)
+ options |= WNOHANG;
while (lp == NULL)
{
@@ -2928,7 +2921,7 @@ retry:
In sync mode, suspend waiting for a SIGCHLD signal. */
if (options & __WCLONE)
{
- if (target_can_async_p ())
+ if (target_options & TARGET_WNOHANG)
{
/* No interesting event. */
ourstatus->kind = TARGET_WAITKIND_IGNORE;
@@ -3072,7 +3065,8 @@ retry:
static ptid_t
linux_nat_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus)
+ ptid_t ptid, struct target_waitstatus *ourstatus,
+ int target_options)
{
ptid_t event_ptid;
@@ -3083,7 +3077,7 @@ linux_nat_wait (struct target_ops *ops,
if (target_can_async_p ())
async_file_flush ();
- event_ptid = linux_nat_wait_1 (ops, ptid, ourstatus);
+ event_ptid = linux_nat_wait_1 (ops, ptid, ourstatus, target_options);
/* If we requested any event, and something came out, assume there
may be more. If we requested a specific lwp or process, also