* linux-low.c (linux_wait_1): Don't set last_status here.

* server.c (push_event, queue_stop_reply_callback): Assert we're
	not pushing a TARGET_WAITKIND_IGNORE event.
	(start_inferior, start_inferior, attach_inferior, handle_v_cont)
	(myresume, handle_target_event): Set the thread's last_resume_kind
	and last_status from the target returned status.
This commit is contained in:
Pedro Alves
2010-08-25 16:27:05 +00:00
parent 5fec85997f
commit d20a8ad9c0
3 changed files with 47 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2010-08-25 Pedro Alves <pedro@codesourcery.com>
* linux-low.c (linux_wait_1): Don't set last_status here.
* server.c (push_event, queue_stop_reply_callback): Assert we're
not pushing a TARGET_WAITKIND_IGNORE event.
(start_inferior, start_inferior, attach_inferior, handle_v_cont)
(myresume, handle_target_event): Set the thread's last_resume_kind
and last_status from the target returned status.
2010-08-25 Pedro Alves <pedro@codesourcery.com> 2010-08-25 Pedro Alves <pedro@codesourcery.com>
PR threads/10729 PR threads/10729

View File

@ -2391,9 +2391,6 @@ Check if we're already there.\n",
ourstatus->kind, ourstatus->kind,
ourstatus->value.sig); ourstatus->value.sig);
if (!stabilizing_threads)
current_inferior->last_status = *ourstatus;
return ptid_of (event_child); return ptid_of (event_child);
} }

View File

@ -158,6 +158,8 @@ queue_stop_reply (ptid_t ptid, struct target_waitstatus *status)
void void
push_event (ptid_t ptid, struct target_waitstatus *status) push_event (ptid_t ptid, struct target_waitstatus *status)
{ {
gdb_assert (status->kind != TARGET_WAITKIND_IGNORE);
queue_stop_reply (ptid, status); queue_stop_reply (ptid, status);
/* If this is the first stop reply in the queue, then inform GDB /* If this is the first stop reply in the queue, then inform GDB
@ -292,9 +294,14 @@ start_inferior (char **argv)
mywait (pid_to_ptid (signal_pid), &last_status, 0, 0); mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
if (last_status.kind != TARGET_WAITKIND_STOPPED) if (last_status.kind != TARGET_WAITKIND_STOPPED)
return signal_pid; return signal_pid;
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
} }
while (last_status.value.sig != TARGET_SIGNAL_TRAP); while (last_status.value.sig != TARGET_SIGNAL_TRAP);
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
return signal_pid; return signal_pid;
} }
@ -302,6 +309,13 @@ start_inferior (char **argv)
(assuming success). */ (assuming success). */
last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0); last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
if (last_status.kind != TARGET_WAITKIND_EXITED
&& last_status.kind != TARGET_WAITKIND_SIGNALLED)
{
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
}
return signal_pid; return signal_pid;
} }
@ -332,6 +346,9 @@ attach_inferior (int pid)
if (last_status.kind == TARGET_WAITKIND_STOPPED if (last_status.kind == TARGET_WAITKIND_STOPPED
&& last_status.value.sig == TARGET_SIGNAL_STOP) && last_status.value.sig == TARGET_SIGNAL_STOP)
last_status.value.sig = TARGET_SIGNAL_TRAP; last_status.value.sig = TARGET_SIGNAL_TRAP;
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
} }
return 0; return 0;
@ -1780,6 +1797,10 @@ handle_v_cont (char *own_buf)
{ {
last_ptid = mywait (minus_one_ptid, &last_status, 0, 1); last_ptid = mywait (minus_one_ptid, &last_status, 0, 1);
if (last_status.kind != TARGET_WAITKIND_EXITED
&& last_status.kind != TARGET_WAITKIND_SIGNALLED)
current_inferior->last_status = last_status;
/* From the client's perspective, all-stop mode always stops all /* From the client's perspective, all-stop mode always stops all
threads implicitly (and the target backend has already done threads implicitly (and the target backend has already done
so by now). Tag all threads as "want-stopped", so we don't so by now). Tag all threads as "want-stopped", so we don't
@ -2089,6 +2110,14 @@ myresume (char *own_buf, int step, int sig)
else else
{ {
last_ptid = mywait (minus_one_ptid, &last_status, 0, 1); last_ptid = mywait (minus_one_ptid, &last_status, 0, 1);
if (last_status.kind != TARGET_WAITKIND_EXITED
&& last_status.kind != TARGET_WAITKIND_SIGNALLED)
{
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
}
prepare_resume_reply (own_buf, last_ptid, &last_status); prepare_resume_reply (own_buf, last_ptid, &last_status);
disable_async_io (); disable_async_io ();
@ -2128,6 +2157,8 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
target_pid_to_str (entry->id), target_pid_to_str (entry->id),
target_waitstatus_to_string (&thread->last_status)); target_waitstatus_to_string (&thread->last_status));
gdb_assert (thread->last_status.kind != TARGET_WAITKIND_IGNORE);
/* Pass the last stop reply back to GDB, but don't notify /* Pass the last stop reply back to GDB, but don't notify
yet. */ yet. */
queue_stop_reply (entry->id, &thread->last_status); queue_stop_reply (entry->id, &thread->last_status);
@ -3135,10 +3166,13 @@ handle_target_event (int err, gdb_client_data client_data)
mourn_inferior (process); mourn_inferior (process);
} }
else else
/* We're reporting this thread as stopped. Update it's {
"want-stopped" state to what the client wants, until it gets /* We're reporting this thread as stopped. Update its
a new resume action. */ "want-stopped" state to what the client wants, until it
gdb_wants_thread_stopped (&current_inferior->entry); gets a new resume action. */
current_inferior->last_resume_kind = resume_stop;
current_inferior->last_status = last_status;
}
if (forward_event) if (forward_event)
{ {