thread is off and running. */
bool executing = false;
- /* True if this thread is resumed from infrun's perspective.
- Note that a thread can be marked both as not-executing and
- resumed at the same time. This happens if we try to resume a
- thread that has a wait status pending. We shouldn't let the
- thread really run until that wait status has been processed, but
- we should not process that wait status if we didn't try to let
- the thread run. */
- bool resumed = false;
+ bool resumed () const
+ { return m_resumed; }
+
+ void set_resumed (bool resumed)
+ { m_resumed = resumed; }
/* Frontend view of the thread state. Note that the THREAD_RUNNING/
THREAD_STOPPED states are different from EXECUTING. When the
/* Displaced-step state for this thread. */
displaced_step_thread_state displaced_step_state;
+
+private:
+ /* True if this thread is resumed from infrun's perspective.
+ Note that a thread can be marked both as not-executing and
+ resumed at the same time. This happens if we try to resume a
+ thread that has a wait status pending. We shouldn't let the
+ thread really run until that wait status has been processed, but
+ we should not process that wait status if we didn't try to let
+ the thread run. */
+ bool m_resumed = false;
};
/* A gdb::ref_ptr pointer to a thread_info. */
}
if (tp->control.trap_expected
- || tp->resumed
+ || tp->resumed ()
|| tp->executing)
{
internal_error (__FILE__, __LINE__,
"trap_expected=%d, resumed=%d, executing=%d\n",
target_pid_to_str (tp->ptid).c_str (),
tp->control.trap_expected,
- tp->resumed,
+ tp->resumed (),
tp->executing);
}
/* If the thread's step over could not be initiated because no buffers
were available, it was re-added to the global step over chain. */
- if (tp->resumed)
+ if (tp->resumed ())
{
infrun_debug_printf ("[%s] was resumed.",
target_pid_to_str (tp->ptid).c_str ());
currently_stepping (tp));
tp->inf->process_target ()->threads_executing = true;
- tp->resumed = true;
+ tp->set_resumed (true);
/* FIXME: What should we do if we are supposed to resume this
thread with a signal? Maybe we should maintain a queue of
resume_ptid = internal_resume_ptid (user_step);
do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
- tp->resumed = true;
+ tp->set_resumed (true);
return;
}
}
}
do_target_resume (resume_ptid, step, sig);
- tp->resumed = true;
+ tp->set_resumed (true);
}
/* Resume the inferior. SIG is the signal to give the inferior
resuming more threads. */
bool has_thread_with_pending_status = false;
for (thread_info *thread : all_non_exited_threads (proc_target))
- if (thread->resumed && thread->suspend.waitstatus_pending_p)
+ if (thread->resumed () && thread->suspend.waitstatus_pending_p)
{
has_thread_with_pending_status = true;
break;
continue;
}
- if (tp->resumed)
+ if (tp->resumed ())
{
infrun_debug_printf ("[%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
error (_("Command aborted."));
}
}
- else if (!cur_thr->resumed && !thread_is_in_step_over_chain (cur_thr))
+ else if (!cur_thr->resumed () && !thread_is_in_step_over_chain (cur_thr))
{
/* The thread wasn't started, and isn't queued, run it now. */
reset_ecs (ecs, cur_thr);
/* Otherwise we can process the (new) pending event now. Set
it so this pending event is considered by
do_target_wait. */
- tp->resumed = true;
+ tp->set_resumed (true);
}
}
auto has_event = [&] (thread_info *tp)
{
return (tp->ptid.matches (waiton_ptid)
- && tp->resumed
+ && tp->resumed ()
&& tp->suspend.waitstatus_pending_p);
};
}
}
else
- thr->resumed = false;
+ thr->set_resumed (false);
}
}
t->stop_requested = 0;
t->executing = 0;
- t->resumed = false;
+ t->set_resumed (false);
t->control.may_range_step = 0;
/* This may be the first time we see the inferior report
/* The thread may be not executing, but still be
resumed with a pending status to process. */
- t->resumed = false;
+ t->set_resumed (false);
}
}
continue;
}
- if (tp->resumed)
+ if (tp->resumed ())
{
infrun_debug_printf ("restart threads: [%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
{
infrun_debug_printf ("restart threads: [%s] needs step-over",
target_pid_to_str (tp->ptid).c_str ());
- gdb_assert (!tp->resumed);
+ gdb_assert (!tp->resumed ());
continue;
}
{
infrun_debug_printf ("restart threads: [%s] has pending status",
target_pid_to_str (tp->ptid).c_str ());
- tp->resumed = true;
+ tp->set_resumed (true);
continue;
}
resumed_thread_with_pending_status (struct thread_info *tp,
void *arg)
{
- return (tp->resumed
+ return (tp->resumed ()
&& tp->suspend.waitstatus_pending_p);
}
/* This was cleared early, by handle_inferior_event. Set it
so this pending event is considered by
do_target_wait. */
- tp->resumed = true;
+ tp->set_resumed (true);
gdb_assert (!tp->executing);
/* If we have a pending event to process, skip resuming the
target and go straight to processing it. */
- if (thr->resumed && thr->suspend.waitstatus_pending_p)
+ if (thr->resumed () && thr->suspend.waitstatus_pending_p)
return;
}
get_frame_address_space (frame),
tp->suspend.stop_pc);
- tp->resumed = true;
+ tp->set_resumed (true);
resume_ptid = internal_resume_ptid (tp->control.stepping_command);
do_target_resume (resume_ptid, false, GDB_SIGNAL_0);
}
keep_going_pass_signal (struct execution_control_state *ecs)
{
gdb_assert (ecs->event_thread->ptid == inferior_ptid);
- gdb_assert (!ecs->event_thread->resumed);
+ gdb_assert (!ecs->event_thread->resumed ());
/* Save the pc before execution, to compare with pc after stop. */
ecs->event_thread->prev_pc