mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
* 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.
This commit is contained in:
parent
9944e9c2ac
commit
47608cb1ac
@ -1,3 +1,54 @@
|
||||
2009-05-21 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2009-05-21 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* mi/mi-interp.c (mi_on_resume): Account for whole process
|
||||
|
@ -345,13 +345,13 @@ bsd_uthread_xfer_partial (struct target_ops *ops, enum target_object object,
|
||||
|
||||
static ptid_t
|
||||
bsd_uthread_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
CORE_ADDR addr;
|
||||
struct target_ops *beneath = find_target_beneath (ops);
|
||||
|
||||
/* Pass the request to the layer beneath. */
|
||||
ptid = beneath->to_wait (beneath, ptid, status);
|
||||
ptid = beneath->to_wait (beneath, ptid, status, options);
|
||||
|
||||
/* If the process is no longer alive, there's no point in figuring
|
||||
out the thread ID. It will fail anyway. */
|
||||
|
@ -476,7 +476,7 @@ catch_exception_raise (mach_port_t port,
|
||||
|
||||
static ptid_t
|
||||
darwin_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
kern_return_t kret;
|
||||
mach_msg_header_t *hdr = &msgin.hdr;
|
||||
|
@ -1111,7 +1111,8 @@ extern void (*deprecated_register_changed_hook) (int regno);
|
||||
extern void (*deprecated_memory_changed_hook) (CORE_ADDR addr, int len);
|
||||
extern void (*deprecated_context_hook) (int);
|
||||
extern ptid_t (*deprecated_target_wait_hook) (ptid_t ptid,
|
||||
struct target_waitstatus * status);
|
||||
struct target_waitstatus *status,
|
||||
int options);
|
||||
|
||||
extern void (*deprecated_attach_hook) (void);
|
||||
extern void (*deprecated_detach_hook) (void);
|
||||
|
@ -448,7 +448,7 @@ startup_inferior (int ntraps)
|
||||
|
||||
struct target_waitstatus ws;
|
||||
memset (&ws, 0, sizeof (ws));
|
||||
event_ptid = target_wait (resume_ptid, &ws);
|
||||
event_ptid = target_wait (resume_ptid, &ws, 0);
|
||||
|
||||
if (ws.kind == TARGET_WAITKIND_IGNORE)
|
||||
/* The inferior didn't really stop, keep waiting. */
|
||||
|
@ -1435,7 +1435,7 @@ struct inf *waiting_inf;
|
||||
/* Wait for something to happen in the inferior, returning what in STATUS. */
|
||||
static ptid_t
|
||||
gnu_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
struct msg
|
||||
{
|
||||
|
@ -416,7 +416,7 @@ static char child_cwd[FILENAME_MAX];
|
||||
|
||||
static ptid_t
|
||||
go32_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
int i;
|
||||
unsigned char saved_opcode;
|
||||
|
@ -190,7 +190,7 @@ hpux_thread_resume (struct target_ops *ops,
|
||||
|
||||
static ptid_t
|
||||
hpux_thread_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
ptid_t rtnval;
|
||||
struct cleanup *old_chain;
|
||||
@ -203,7 +203,7 @@ hpux_thread_wait (struct target_ops *ops,
|
||||
ptid = main_ptid;
|
||||
|
||||
rtnval = deprecated_child_ops.to_wait (&deprecated_child_ops,
|
||||
ptid, ourstatus);
|
||||
ptid, ourstatus, options);
|
||||
|
||||
rtnval = find_active_thread ();
|
||||
|
||||
|
@ -396,7 +396,7 @@ inf_ptrace_resume (struct target_ops *ops,
|
||||
|
||||
static ptid_t
|
||||
inf_ptrace_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
pid_t pid;
|
||||
int status, save_errno;
|
||||
|
@ -924,7 +924,7 @@ inf_ttrace_resume (struct target_ops *ops,
|
||||
|
||||
static ptid_t
|
||||
inf_ttrace_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
pid_t pid = ptid_get_pid (ptid);
|
||||
lwpid_t lwpid = ptid_get_lwp (ptid);
|
||||
|
@ -1842,9 +1842,9 @@ wait_for_inferior (int treat_exec_as_sigtrap)
|
||||
struct cleanup *old_chain;
|
||||
|
||||
if (deprecated_target_wait_hook)
|
||||
ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
|
||||
ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws, 0);
|
||||
else
|
||||
ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
|
||||
ecs->ptid = target_wait (waiton_ptid, &ecs->ws, 0);
|
||||
|
||||
if (debug_infrun)
|
||||
print_target_wait_results (waiton_ptid, ecs->ptid, &ecs->ws);
|
||||
@ -1920,9 +1920,9 @@ fetch_inferior_event (void *client_data)
|
||||
|
||||
if (deprecated_target_wait_hook)
|
||||
ecs->ptid =
|
||||
deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
|
||||
deprecated_target_wait_hook (waiton_ptid, &ecs->ws, TARGET_WNOHANG);
|
||||
else
|
||||
ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
|
||||
ecs->ptid = target_wait (waiton_ptid, &ecs->ws, TARGET_WNOHANG);
|
||||
|
||||
if (debug_infrun)
|
||||
print_target_wait_results (waiton_ptid, ecs->ptid, &ecs->ws);
|
||||
|
@ -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 @@ linux_nat_wait_1 (struct target_ops *ops,
|
||||
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 @@ linux_nat_wait_1 (struct target_ops *ops,
|
||||
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 @@ linux_nat_wait_1 (struct target_ops *ops,
|
||||
|
||||
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
|
||||
|
@ -1178,12 +1178,13 @@ check_event (ptid_t ptid)
|
||||
|
||||
static ptid_t
|
||||
thread_db_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus,
|
||||
int options)
|
||||
{
|
||||
struct thread_db_info *info;
|
||||
struct target_ops *beneath = find_target_beneath (ops);
|
||||
|
||||
ptid = beneath->to_wait (beneath, ptid, ourstatus);
|
||||
ptid = beneath->to_wait (beneath, ptid, ourstatus, options);
|
||||
|
||||
if (ourstatus->kind == TARGET_WAITKIND_IGNORE)
|
||||
return ptid;
|
||||
|
@ -1065,7 +1065,7 @@ monitor_wait_filter (char *buf,
|
||||
|
||||
static ptid_t
|
||||
monitor_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
int old_timeout = timeout;
|
||||
char buf[TARGET_BUF_SIZE];
|
||||
|
@ -623,7 +623,7 @@ nto_interrupt (int signo)
|
||||
|
||||
static ptid_t
|
||||
procfs_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
sigset_t set;
|
||||
siginfo_t info;
|
||||
|
10
gdb/record.c
10
gdb/record.c
@ -98,7 +98,8 @@ static void (*record_beneath_to_resume) (struct target_ops *, ptid_t, int,
|
||||
enum target_signal);
|
||||
static struct target_ops *record_beneath_to_wait_ops;
|
||||
static ptid_t (*record_beneath_to_wait) (struct target_ops *, ptid_t,
|
||||
struct target_waitstatus *);
|
||||
struct target_waitstatus *,
|
||||
int);
|
||||
static struct target_ops *record_beneath_to_store_registers_ops;
|
||||
static void (*record_beneath_to_store_registers) (struct target_ops *,
|
||||
struct regcache *,
|
||||
@ -566,7 +567,8 @@ record_wait_cleanups (void *ignore)
|
||||
|
||||
static ptid_t
|
||||
record_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status,
|
||||
int options)
|
||||
{
|
||||
struct cleanup *set_cleanups = record_gdb_operation_disable_set ();
|
||||
|
||||
@ -590,7 +592,7 @@ record_wait (struct target_ops *ops,
|
||||
{
|
||||
/* This is a single step. */
|
||||
return record_beneath_to_wait (record_beneath_to_wait_ops,
|
||||
ptid, status);
|
||||
ptid, status, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -601,7 +603,7 @@ record_wait (struct target_ops *ops,
|
||||
while (1)
|
||||
{
|
||||
ret = record_beneath_to_wait (record_beneath_to_wait_ops,
|
||||
ptid, status);
|
||||
ptid, status, 0);
|
||||
|
||||
if (status->kind == TARGET_WAITKIND_STOPPED
|
||||
&& status->value.sig == TARGET_SIGNAL_TRAP)
|
||||
|
@ -1695,7 +1695,7 @@ mips_signal_from_protocol (int sig)
|
||||
|
||||
static ptid_t
|
||||
mips_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
int rstatus;
|
||||
int err;
|
||||
|
@ -676,7 +676,7 @@ gdbsim_cntrl_c (int signo)
|
||||
|
||||
static ptid_t
|
||||
gdbsim_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
static RETSIGTYPE (*prev_sigint) ();
|
||||
int sigrc = 0;
|
||||
|
39
gdb/remote.c
39
gdb/remote.c
@ -4646,7 +4646,7 @@ process_stop_reply (struct stop_reply *stop_reply,
|
||||
/* The non-stop mode version of target_wait. */
|
||||
|
||||
static ptid_t
|
||||
remote_wait_ns (ptid_t ptid, struct target_waitstatus *status)
|
||||
remote_wait_ns (ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
struct remote_state *rs = get_remote_state ();
|
||||
struct remote_arch_state *rsa = get_remote_arch_state ();
|
||||
@ -4688,16 +4688,15 @@ remote_wait_ns (ptid_t ptid, struct target_waitstatus *status)
|
||||
if (stop_reply != NULL)
|
||||
return process_stop_reply (stop_reply, status);
|
||||
|
||||
/* Still no event. If we're in asynchronous mode, then just
|
||||
/* Still no event. If we're just polling for an event, then
|
||||
return to the event loop. */
|
||||
if (remote_is_async_p ())
|
||||
if (options & TARGET_WNOHANG)
|
||||
{
|
||||
status->kind = TARGET_WAITKIND_IGNORE;
|
||||
return minus_one_ptid;
|
||||
}
|
||||
|
||||
/* Otherwise, asynchronous mode is masked, so do a blocking
|
||||
wait. */
|
||||
/* Otherwise do a blocking wait. */
|
||||
ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size,
|
||||
1 /* forever */);
|
||||
}
|
||||
@ -4707,7 +4706,7 @@ remote_wait_ns (ptid_t ptid, struct target_waitstatus *status)
|
||||
STATUS just as `wait' would. */
|
||||
|
||||
static ptid_t
|
||||
remote_wait_as (ptid_t ptid, struct target_waitstatus *status)
|
||||
remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
struct remote_state *rs = get_remote_state ();
|
||||
struct remote_arch_state *rsa = get_remote_arch_state ();
|
||||
@ -4717,6 +4716,8 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status)
|
||||
char *buf, *p;
|
||||
struct stop_reply *stop_reply;
|
||||
|
||||
again:
|
||||
|
||||
status->kind = TARGET_WAITKIND_IGNORE;
|
||||
status->value.integer = 0;
|
||||
|
||||
@ -4819,8 +4820,14 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status)
|
||||
}
|
||||
|
||||
if (status->kind == TARGET_WAITKIND_IGNORE)
|
||||
/* Nothing interesting happened. */
|
||||
return minus_one_ptid;
|
||||
{
|
||||
/* Nothing interesting happened. If we're doing a non-blocking
|
||||
poll, we're done. Otherwise, go back to waiting. */
|
||||
if (options & TARGET_WNOHANG)
|
||||
return minus_one_ptid;
|
||||
else
|
||||
goto again;
|
||||
}
|
||||
else if (status->kind != TARGET_WAITKIND_EXITED
|
||||
&& status->kind != TARGET_WAITKIND_SIGNALLED)
|
||||
{
|
||||
@ -4841,24 +4848,14 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status)
|
||||
|
||||
static ptid_t
|
||||
remote_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *status)
|
||||
ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
ptid_t event_ptid;
|
||||
|
||||
if (non_stop)
|
||||
event_ptid = remote_wait_ns (ptid, status);
|
||||
event_ptid = remote_wait_ns (ptid, status, options);
|
||||
else
|
||||
{
|
||||
/* In synchronous mode, keep waiting until the target stops. In
|
||||
asynchronous mode, always return to the event loop. */
|
||||
|
||||
do
|
||||
{
|
||||
event_ptid = remote_wait_as (ptid, status);
|
||||
}
|
||||
while (status->kind == TARGET_WAITKIND_IGNORE
|
||||
&& !target_can_async_p ());
|
||||
}
|
||||
event_ptid = remote_wait_as (ptid, status, options);
|
||||
|
||||
if (target_can_async_p ())
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ rs6000_xfer_partial (struct target_ops *ops, enum target_object object,
|
||||
|
||||
static ptid_t
|
||||
rs6000_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
pid_t pid;
|
||||
int status, save_errno;
|
||||
|
@ -381,7 +381,7 @@ sol_thread_resume (struct target_ops *ops,
|
||||
|
||||
static ptid_t
|
||||
sol_thread_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
ptid_t rtnval;
|
||||
ptid_t save_ptid;
|
||||
@ -407,7 +407,7 @@ sol_thread_wait (struct target_ops *ops,
|
||||
GET_THREAD (save_ptid));
|
||||
}
|
||||
|
||||
rtnval = beneath->to_wait (beneath, ptid, ourstatus);
|
||||
rtnval = beneath->to_wait (beneath, ptid, ourstatus, options);
|
||||
|
||||
if (ourstatus->kind != TARGET_WAITKIND_EXITED)
|
||||
{
|
||||
|
@ -422,7 +422,7 @@ spu_child_post_attach (int pid)
|
||||
minus_one_ptid in case of error; store status into *OURSTATUS. */
|
||||
static ptid_t
|
||||
spu_child_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
int save_errno;
|
||||
int status;
|
||||
|
@ -1836,7 +1836,7 @@ target_disconnect (char *args, int from_tty)
|
||||
}
|
||||
|
||||
ptid_t
|
||||
target_wait (ptid_t ptid, struct target_waitstatus *status)
|
||||
target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
@ -1844,7 +1844,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status)
|
||||
{
|
||||
if (t->to_wait != NULL)
|
||||
{
|
||||
ptid_t retval = (*t->to_wait) (t, ptid, status);
|
||||
ptid_t retval = (*t->to_wait) (t, ptid, status, options);
|
||||
|
||||
if (targetdebug)
|
||||
{
|
||||
|
15
gdb/target.h
15
gdb/target.h
@ -153,6 +153,13 @@ struct target_waitstatus
|
||||
value;
|
||||
};
|
||||
|
||||
/* Options that can be passed to target_wait. */
|
||||
|
||||
/* Return immediately if there's no event already queued. If this
|
||||
options is not requested, target_wait blocks waiting for an
|
||||
event. */
|
||||
#define TARGET_WNOHANG 1
|
||||
|
||||
/* Return a pretty printed form of target_waitstatus.
|
||||
Space for the result is malloc'd, caller must free. */
|
||||
extern char *target_waitstatus_to_string (const struct target_waitstatus *);
|
||||
@ -327,7 +334,7 @@ struct target_ops
|
||||
void (*to_disconnect) (struct target_ops *, char *, int);
|
||||
void (*to_resume) (struct target_ops *, ptid_t, int, enum target_signal);
|
||||
ptid_t (*to_wait) (struct target_ops *,
|
||||
ptid_t, struct target_waitstatus *);
|
||||
ptid_t, struct target_waitstatus *, int);
|
||||
void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
|
||||
void (*to_store_registers) (struct target_ops *, struct regcache *, int);
|
||||
void (*to_prepare_to_store) (struct regcache *);
|
||||
@ -621,9 +628,11 @@ extern void target_resume (ptid_t ptid, int step, enum target_signal signal);
|
||||
_NOT_ OK to throw_exception() out of target_wait() without popping
|
||||
the debugging target from the stack; GDB isn't prepared to get back
|
||||
to the prompt with a debugging target but without the frame cache,
|
||||
stop_pc, etc., set up. */
|
||||
stop_pc, etc., set up. OPTIONS is a bitwise OR of TARGET_W*
|
||||
options. */
|
||||
|
||||
extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status);
|
||||
extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
|
||||
int options);
|
||||
|
||||
/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
|
||||
|
||||
|
@ -266,7 +266,8 @@ void (*deprecated_memory_changed_hook) (CORE_ADDR addr, int len);
|
||||
while waiting for target events. */
|
||||
|
||||
ptid_t (*deprecated_target_wait_hook) (ptid_t ptid,
|
||||
struct target_waitstatus * status);
|
||||
struct target_waitstatus *status,
|
||||
int options);
|
||||
|
||||
/* Used by UI as a wrapper around command execution. May do various things
|
||||
like enabling/disabling buttons, etc... */
|
||||
|
@ -160,7 +160,7 @@ tui_event_modify_breakpoint (int number)
|
||||
Leave curses mode and setup program mode. */
|
||||
static ptid_t
|
||||
tui_target_wait_hook (ptid_t pid,
|
||||
struct target_waitstatus *status)
|
||||
struct target_waitstatus *status, int options)
|
||||
{
|
||||
ptid_t res;
|
||||
|
||||
@ -174,7 +174,7 @@ tui_target_wait_hook (ptid_t pid,
|
||||
}
|
||||
#endif
|
||||
tui_target_has_run = 1;
|
||||
res = target_wait (pid, status);
|
||||
res = target_wait (pid, status, options);
|
||||
|
||||
if (tui_active)
|
||||
{
|
||||
|
@ -1494,7 +1494,7 @@ get_windows_debug_event (struct target_ops *ops,
|
||||
/* Wait for interesting events to occur in the target process. */
|
||||
static ptid_t
|
||||
windows_wait (struct target_ops *ops,
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ptid_t ptid, struct target_waitstatus *ourstatus, int options)
|
||||
{
|
||||
int pid = -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user