+#include "inferior.h"
+#include "btrace.h"
+#include "common/vec.h"
+#include "target/waitstatus.h"
+#include "cli/cli-utils.h"
+
+/* Frontend view of the thread state. Possible extensions: stepping,
+ finishing, until(ling),... */
+enum thread_state
+{
+ THREAD_STOPPED,
+ THREAD_RUNNING,
+ THREAD_EXITED,
+};
+
+/* Inferior thread specific part of `struct infcall_control_state'.
+
+ Inferior process counterpart is `struct inferior_control_state'. */
+
+struct thread_control_state
+{
+ /* User/external stepping state. */
+
+ /* Step-resume or longjmp-resume breakpoint. */
+ struct breakpoint *step_resume_breakpoint;
+
+ /* Exception-resume breakpoint. */
+ struct breakpoint *exception_resume_breakpoint;
+
+ /* Breakpoints used for software single stepping. Plural, because
+ it may have multiple locations. E.g., if stepping over a
+ conditional branch instruction we can't decode the condition for,
+ we'll need to put a breakpoint at the branch destination, and
+ another at the instruction after the branch. */
+ struct breakpoint *single_step_breakpoints;
+
+ /* Range to single step within.
+
+ If this is nonzero, respond to a single-step signal by continuing
+ to step if the pc is in this range.
+
+ If step_range_start and step_range_end are both 1, it means to
+ step for a single instruction (FIXME: it might clean up
+ wait_for_inferior in a minor way if this were changed to the
+ address of the instruction and that address plus one. But maybe
+ not). */
+ CORE_ADDR step_range_start; /* Inclusive */
+ CORE_ADDR step_range_end; /* Exclusive */
+
+ /* Function the thread was in as of last it started stepping. */
+ struct symbol *step_start_function;
+
+ /* If GDB issues a target step request, and this is nonzero, the
+ target should single-step this thread once, and then continue
+ single-stepping it without GDB core involvement as long as the
+ thread stops in the step range above. If this is zero, the
+ target should ignore the step range, and only issue one single
+ step. */
+ int may_range_step;
+
+ /* Stack frame address as of when stepping command was issued.
+ This is how we know when we step into a subroutine call, and how
+ to set the frame for the breakpoint used to step out. */
+ struct frame_id step_frame_id;
+
+ /* Similarly, the frame ID of the underlying stack frame (skipping
+ any inlined frames). */
+ struct frame_id step_stack_frame_id;
+
+ /* Nonzero if we are presently stepping over a breakpoint.
+
+ If we hit a breakpoint or watchpoint, and then continue, we need
+ to single step the current thread with breakpoints disabled, to
+ avoid hitting the same breakpoint or watchpoint again. And we
+ should step just a single thread and keep other threads stopped,
+ so that other threads don't miss breakpoints while they are
+ removed.
+
+ So, this variable simultaneously means that we need to single
+ step the current thread, keep other threads stopped, and that
+ breakpoints should be removed while we step.
+
+ This variable is set either:
+ - in proceed, when we resume inferior on user's explicit request
+ - in keep_going, if handle_inferior_event decides we need to
+ step over breakpoint.
+
+ The variable is cleared in normal_stop. The proceed calls
+ wait_for_inferior, which calls handle_inferior_event in a loop,
+ and until wait_for_inferior exits, this variable is changed only
+ by keep_going. */
+ int trap_expected;
+
+ /* Nonzero if the thread is being proceeded for a "finish" command
+ or a similar situation when return value should be printed. */
+ int proceed_to_finish;
+
+ /* Nonzero if the thread is being proceeded for an inferior function
+ call. */
+ int in_infcall;
+
+ enum step_over_calls_kind step_over_calls;
+
+ /* Nonzero if stopped due to a step command. */
+ int stop_step;
+
+ /* Chain containing status of breakpoint(s) the thread stopped
+ at. */
+ bpstat stop_bpstat;
+
+ /* Whether the command that started the thread was a stepping
+ command. This is used to decide whether "set scheduler-locking
+ step" behaves like "on" or "off". */
+ int stepping_command;
+};
+
+/* Inferior thread specific part of `struct infcall_suspend_state'. */
+
+struct thread_suspend_state
+{
+ /* Last signal that the inferior received (why it stopped). When
+ the thread is resumed, this signal is delivered. Note: the
+ target should not check whether the signal is in pass state,
+ because the signal may have been explicitly passed with the
+ "signal" command, which overrides "handle nopass". If the signal
+ should be suppressed, the core will take care of clearing this
+ before the target is resumed. */
+ enum gdb_signal stop_signal;
+
+ /* The reason the thread last stopped, if we need to track it
+ (breakpoint, watchpoint, etc.) */
+ enum target_stop_reason stop_reason;
+
+ /* The waitstatus for this thread's last event. */
+ struct target_waitstatus waitstatus;
+ /* If true WAITSTATUS hasn't been handled yet. */
+ int waitstatus_pending_p;
+
+ /* Record the pc of the thread the last time it stopped. (This is
+ not the current thread's PC as that may have changed since the
+ last stop, e.g., "return" command, or "p $pc = 0xf000"). This is
+ used in coordination with stop_reason and waitstatus_pending_p:
+ if the thread's PC is changed since it last stopped, a pending
+ breakpoint waitstatus is discarded. */
+ CORE_ADDR stop_pc;
+};
+
+typedef struct value *value_ptr;
+DEF_VEC_P (value_ptr);
+typedef VEC (value_ptr) value_vec;