2005-11-08 Kevin Buettner <kevinb@redhat.com>
+ * lwp-pool.c (struct lwp): Add new member `do_step'.
+ (wait_and_handle): Clear `do_step' when a SIGTRAP is received.
+ (continue_or_step_lwp): New function.
+ (lwp_pool_continue_all, lwp_pool_continue_lwp): Call
+ continue_or_step_lwp() instead of continue_lwp().
+ (lwp_singlestep_lwp): Set `do_step' after a successful call to
+ singlestep_lwp().
+
+2005-11-08 Kevin Buettner <kevinb@redhat.com>
+
* linux-target.c (am33_singlestep_okay): Use `pid', not
`process->pid' when reading and writing memory since the
latter may refer to an already running thread.
/* If STATE is one of the lwp_state_*_interesting states, then
STATUS is the interesting wait status. */
int status;
+
+ /* Indicates the stepping status. We must be prepared to step the
+ given lwp upon continue since it's possible to get thread notification
+ signals prior to a step actually occuring. Receipt of a SIGTRAP is
+ sufficient to clear this flag. */
+ int do_step;
};
stopsig = WSTOPSIG (status);
+ if (stopsig == SIGTRAP)
+ {
+ /* No longer stepping once a SIGTRAP is received. */
+ l->do_step = 0;
+ }
+
switch (l->state)
{
case lwp_state_uninitialized:
}
}
+int
+continue_or_step_lwp (struct gdbserv *serv, struct lwp *l, int sig)
+{
+ int status;
+ if (l->do_step)
+ status = singlestep_lwp (serv, l->pid, sig);
+ else
+ status = continue_lwp (l->pid, sig);
+
+ return status;
+}
+
void
lwp_pool_continue_all (struct gdbserv *serv)
break;
case lwp_state_stopped:
- if (continue_lwp (l->pid, 0) == 0)
+ if (continue_or_step_lwp (serv, l, 0) == 0)
l->state = lwp_state_running;
break;
l->state = lwp_state_running_stop_pending;
if (check_stop_pending (serv, l) == 0)
{
- if (continue_lwp (l->pid, 0) == 0)
+ if (continue_or_step_lwp (serv, l, 0) == 0)
l->state = lwp_state_running;
}
}
break;
case lwp_state_stopped:
- result = continue_lwp (l->pid, signal);
+ result = continue_or_step_lwp (serv, l, signal);
if (result == 0)
l->state = lwp_state_running;
break;
l->state = lwp_state_running_stop_pending;
if (check_stop_pending (serv, l) == 0)
{
- if (continue_lwp (l->pid, 0) == 0)
+ if (continue_or_step_lwp (serv, l, 0) == 0)
l->state = lwp_state_running;
}
}
case lwp_state_stopped:
result = singlestep_lwp (serv, l->pid, signal);
if (result == 0)
- l->state = lwp_state_running;
+ {
+ l->state = lwp_state_running;
+ l->do_step = 1;
+ }
break;
case lwp_state_stopped_stop_pending:
if (check_stop_pending (serv, l) == 0)
{
if (singlestep_lwp (serv, l->pid, 0) == 0)
- l->state = lwp_state_running;
+ {
+ l->state = lwp_state_running;
+ l->do_step = 1;
+ }
}
}
break;