return (b->pspace == current_program_space
&& (b->watchpoint_thread == null_ptid
|| (inferior_ptid == b->watchpoint_thread
- && !inferior_thread ()->executing)));
+ && !inferior_thread ()->executing ())));
}
/* Set watchpoint B to disp_del_at_next_stop, even including its possible
return NULL;
thread_info *tp = inferior_thread ();
- if (tp->state == THREAD_EXITED || tp->executing)
+ if (tp->state == THREAD_EXITED || tp->executing ())
return NULL;
return tp;
}
return false;
/* ... or from a spinning thread. */
- if (tp->executing)
+ if (tp->executing ())
return false;
}
if the thread does not have a user-given name. */
char *name = NULL;
- /* True means the thread is executing. Note: this is different
- from saying that there is an active target and we are stopped at
- a breakpoint, for instance. This is a real indicator whether the
- thread is off and running. */
- bool executing = false;
+ bool executing () const
+ { return m_executing; }
+
+ /* Set the thread's 'm_executing' field from EXECUTING, and if EXECUTING
+ is true also clears the thread's stop_pc. */
+ void set_executing (bool executing);
bool resumed () const
{ return m_resumed; }
+ /* Set the thread's 'm_resumed' field from RESUMED. The thread may also
+ be added to (when RESUMED is true), or removed from (when RESUMED is
+ false), the list of threads with a pending wait status. */
void set_resumed (bool resumed);
/* Frontend view of the thread state. Note that the THREAD_RUNNING/
the thread run. */
bool m_resumed = false;
+ /* True means the thread is executing. Note: this is different
+ from saying that there is an active target and we are stopped at
+ a breakpoint, for instance. This is a real indicator whether the
+ thread is off and running. */
+ bool m_executing = false;
+
/* State of inferior thread to restore after GDB is done with an inferior
call. See `struct thread_suspend_state'. */
thread_suspend_state m_suspend;
scoped_restore_current_thread restore_thread;
for (thread_info *thread : inf->non_exited_threads ())
- if (!thread->executing
+ if (!thread->executing ()
&& !thread->stop_requested
&& thread->stop_signal () == GDB_SIGNAL_0)
{
/* When we "notice" a new inferior we need to do all the things we
would normally do if we had just attached to it. */
- if (thr->executing)
+ if (thr->executing ())
{
struct inferior *inferior = current_inferior ();
thread_info *resumed = NULL;
for (thread_info *thr : all_non_exited_threads ())
{
- if (thr->executing)
+ if (thr->executing ())
{
resumed = thr;
break;
proceed_after_vfork_done (thread_info *thread)
{
if (thread->state == THREAD_RUNNING
- && !thread->executing
+ && !thread->executing ()
&& !thread->stop_requested
&& thread->stop_signal () == GDB_SIGNAL_0)
{
if (tp->control.trap_expected
|| tp->resumed ()
- || tp->executing)
+ || tp->executing ())
{
internal_error (__FILE__, __LINE__,
"[%s] has inconsistent state: "
target_pid_to_str (tp->ptid).c_str (),
tp->control.trap_expected,
tp->resumed (),
- tp->executing);
+ tp->executing ());
}
infrun_debug_printf ("resuming [%s] for step-over",
{
infrun_debug_printf ("[%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
- gdb_assert (tp->executing || tp->has_pending_waitstatus ());
+ gdb_assert (tp->executing () || tp->has_pending_waitstatus ());
continue;
}
{
if (tp->state != THREAD_RUNNING)
continue;
- if (tp->executing)
+ if (tp->executing ())
continue;
/* Remove matching threads from the step-over queue, so
{
if (thr->displaced_step_state.in_progress ())
{
- if (thr->executing)
+ if (thr->executing ())
{
if (!thr->stop_requested)
{
t = add_thread (event.target, event.ptid);
t->stop_requested = 0;
- t->executing = 0;
+ t->set_executing (false);
t->set_resumed (false);
t->control.may_range_step = 0;
if (!target_is_non_stop_p ())
continue;
- if (t->executing)
+ if (t->executing ())
{
/* If already stopping, don't request a stop again.
We just haven't seen the notification yet. */
for (thread_info *thread : all_non_exited_threads ())
{
- if (swap_terminal && thread->executing)
+ if (swap_terminal && thread->executing ())
{
if (thread->inf != curr_inf)
{
}
if (!ignore_event
- && (thread->executing || thread->has_pending_waitstatus ()))
+ && (thread->executing () || thread->has_pending_waitstatus ()))
{
/* Either there were no unwaited-for children left in the
target at some point, but there are now, or some target
{
infrun_debug_printf ("restart threads: [%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
- gdb_assert (tp->executing || tp->has_pending_waitstatus ());
+ gdb_assert (tp->executing () || tp->has_pending_waitstatus ());
continue;
}
do_target_wait. */
tp->set_resumed (true);
- gdb_assert (!tp->executing);
+ gdb_assert (!tp->executing ());
regcache = get_thread_regcache (tp);
tp->set_stop_pc (regcache_read_pc (regcache));
/* If we have any thread that is already executing, then we
don't need to resume the target -- it is already been
resumed. */
- if (thr->executing)
+ if (thr->executing ())
return;
/* If we have a pending event to process, skip resuming the
{
struct thread_info *tp = find_thread_ptid (linux_target, lp->ptid);
- if (target_is_non_stop_p () && !tp->executing)
+ if (target_is_non_stop_p () && !tp->executing ())
{
if (tp->has_pending_waitstatus ())
signo = tp->pending_waitstatus ().value.sig;
continue;
thread_info *thread = any_live_thread_of_inferior (inf);
- if (thread == NULL || thread->executing)
+ if (thread == NULL || thread->executing ())
continue;
/* It's best to avoid td_ta_thr_iter if possible. That walks
For the former, EXECUTING is true and we're in wait, about to
move the thread. Since we need to recompute the stack, we temporarily
set EXECUTING to false. */
- executing = tp->executing;
+ executing = tp->executing ();
set_executing (proc_target, inferior_ptid, false);
id = null_frame_id;
{
/* A thread can be THREAD_STOPPED and executing, while
running an infcall. */
- if (thr->state == THREAD_RUNNING || thr->executing)
+ if (thr->state == THREAD_RUNNING || thr->executing ())
{
/* We can get here quite deep in target layers. Avoid
switching thread context or anything that would
/* See gdbthread.h. */
+void
+thread_info::set_executing (bool executing)
+{
+ m_executing = executing;
+ if (executing)
+ this->set_stop_pc (~(CORE_ADDR) 0);
+}
+
+/* See gdbthread.h. */
+
void
thread_info::set_resumed (bool resumed)
{
curr_tp = inferior_thread ();
if (curr_tp->state == THREAD_EXITED)
curr_tp = NULL;
- else if (!curr_tp->executing)
+ else if (!curr_tp->executing ())
return curr_tp;
}
for (thread_info *tp : inf->non_exited_threads ())
{
- if (!tp->executing)
+ if (!tp->executing ())
return tp;
tp_executing = tp;
gdb::observers::target_resumed.notify (ptid);
}
-
-/* Helper for set_executing. Set's the thread's 'executing' field
- from EXECUTING, and if EXECUTING is true also clears the thread's
- stop_pc. */
-
-static void
-set_executing_thread (thread_info *thr, bool executing)
-{
- thr->executing = executing;
- if (executing)
- thr->set_stop_pc (~(CORE_ADDR) 0);
-}
-
void
set_executing (process_stratum_target *targ, ptid_t ptid, bool executing)
{
for (thread_info *tp : all_non_exited_threads (targ, ptid))
- set_executing_thread (tp, executing);
+ tp->set_executing (executing);
/* It only takes one running thread to spawn more threads. */
if (executing)
bool any_started = false;
for (thread_info *tp : all_non_exited_threads (targ, ptid))
- if (set_running_thread (tp, tp->executing))
+ if (set_running_thread (tp, tp->executing ()))
any_started = true;
if (any_started)
at the prompt) when a thread is not executing for some internal
reason, but is marked running from the user's perspective. E.g.,
the thread is waiting for its turn in the step-over queue. */
- if (tp->executing)
+ if (tp->executing ())
error (_("Selected thread is running."));
}
return false;
/* ... or from a spinning thread. FIXME: see validate_registers_access. */
- if (thread->executing)
+ if (thread->executing ())
return false;
return true;
for (thread_info *tp : inf->non_exited_threads ())
{
- if (tp->executing)
+ if (tp->executing ())
{
targ->threads_executing = true;
return;