according to RUNNING. */
static void
-remote_add_thread (ptid_t ptid, int running)
+remote_add_thread (ptid_t ptid, int running, int executing)
{
struct remote_state *rs = get_remote_state ();
else
add_thread (ptid);
- set_executing (ptid, running);
+ set_executing (ptid, executing);
set_running (ptid, running);
}
It may be the first time we hear about such thread, so take the
opportunity to add it to GDB's thread list. In case this is the
first time we're noticing its corresponding inferior, add it to
- GDB's inferior list as well. */
+ GDB's inferior list as well. EXECUTING indicates whether the
+ thread is (internally) executing or stopped. */
static void
-remote_notice_new_inferior (ptid_t currthread, int running)
+remote_notice_new_inferior (ptid_t currthread, int executing)
{
+ /* In non-stop mode, we assume new found threads are (externally)
+ running until proven otherwise with a stop reply. In all-stop,
+ we can only get here if all threads are stopped. */
+ int running = target_is_non_stop_p () ? 1 : 0;
+
/* If this is a new thread, add it to GDB's thread list.
If we leave it up to WFI to do this, bad things will happen. */
{
/* We're seeing an event on a thread id we knew had exited.
This has to be a new thread reusing the old id. Add it. */
- remote_add_thread (currthread, running);
+ remote_add_thread (currthread, running, executing);
return;
}
thread_change_ptid (inferior_ptid, currthread);
else
{
- remote_add_thread (currthread, running);
+ remote_add_thread (currthread, running, executing);
inferior_ptid = currthread;
}
return;
}
/* This is really a new thread. Add it. */
- remote_add_thread (currthread, running);
+ remote_add_thread (currthread, running, executing);
/* If we found a new inferior, let the common code do whatever
it needs to with it (e.g., read shared libraries, insert
struct remote_state *rs = get_remote_state ();
if (!rs->starting_up)
- notice_new_inferior (currthread, running, 0);
+ notice_new_inferior (currthread, executing, 0);
}
}
}
{
struct private_thread_info *info;
/* In non-stop mode, we assume new found threads are
- running until proven otherwise with a stop reply. In
- all-stop, we can only get here if all threads are
+ executing until proven otherwise with a stop reply.
+ In all-stop, we can only get here if all threads are
stopped. */
- int running = target_is_non_stop_p () ? 1 : 0;
+ int executing = target_is_non_stop_p () ? 1 : 0;
- remote_notice_new_inferior (item->ptid, running);
+ remote_notice_new_inferior (item->ptid, executing);
info = demand_private_info (item->ptid);
info->core = item->core;
struct remote_state *rs = get_remote_state ();
char *msg, *reply, *tmp;
int end;
+ long reply_size;
struct cleanup *old_chain;
/* The remote side has no concept of inferiors that aren't running
because we need both at the same time. */
msg = (char *) xmalloc (get_remote_packet_size ());
old_chain = make_cleanup (xfree, msg);
+ reply = (char *) xmalloc (get_remote_packet_size ());
+ make_cleanup (free_current_contents, &reply);
+ reply_size = get_remote_packet_size ();
/* Invite target to request symbol lookups. */
putpkt ("qSymbol::");
- getpkt (&rs->buf, &rs->buf_size, 0);
- packet_ok (rs->buf, &remote_protocol_packets[PACKET_qSymbol]);
- reply = rs->buf;
+ getpkt (&reply, &reply_size, 0);
+ packet_ok (reply, &remote_protocol_packets[PACKET_qSymbol]);
while (startswith (reply, "qSymbol:"))
{
}
putpkt (msg);
- getpkt (&rs->buf, &rs->buf_size, 0);
- reply = rs->buf;
+ getpkt (&reply, &reply_size, 0);
}
do_cleanups (old_chain);
fork child threads from the CONTEXT list. */
ALL_NON_EXITED_THREADS (thread)
{
- struct target_waitstatus *ws = &thread->pending_follow;
+ struct target_waitstatus *ws;
+
+ if (thread->suspend.waitstatus_pending_p)
+ ws = &thread->suspend.waitstatus;
+ else
+ ws = &thread->pending_follow;
if (is_pending_fork_parent (ws, pid, thread->ptid))
{
/* If the user hit C-c before this packet, or between packets,
pretend that it was hit right here. */
if (check_quit_flag ())
- {
- clear_quit_flag ();
- sync_remote_interrupt (SIGINT);
- }
+ sync_remote_interrupt (SIGINT);
}
/* FIXME: cagney/1999-09-27: If we're in async mode we should