summaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c315
1 files changed, 145 insertions, 170 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 0da3bc27942..6c652ea3677 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -899,7 +899,7 @@ proceed_after_vfork_done (struct thread_info *thread,
&& thread->state == THREAD_RUNNING
&& !thread->executing
&& !thread->stop_requested
- && thread->suspend.stop_signal == GDB_SIGNAL_0)
+ && thread->stop_signal () == GDB_SIGNAL_0)
{
infrun_debug_printf ("resuming vfork parent thread %s",
target_pid_to_str (thread->ptid).c_str ());
@@ -2151,7 +2151,7 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
/* Avoid confusing the next resume, if the next stop/resume
happens to apply to another thread. */
- tp->suspend.stop_signal = GDB_SIGNAL_0;
+ tp->set_stop_signal (GDB_SIGNAL_0);
/* Advise target which signals may be handled silently.
@@ -2209,13 +2209,13 @@ resume_1 (enum gdb_signal sig)
gdb_assert (!tp->stop_requested);
gdb_assert (!thread_is_in_step_over_chain (tp));
- if (tp->suspend.waitstatus_pending_p)
+ if (tp->has_pending_waitstatus ())
{
infrun_debug_printf
("thread %s has pending wait "
"status %s (currently_stepping=%d).",
target_pid_to_str (tp->ptid).c_str (),
- target_waitstatus_to_string (&tp->suspend.waitstatus).c_str (),
+ target_waitstatus_to_string (&tp->pending_waitstatus ()).c_str (),
currently_stepping (tp));
tp->inf->process_target ()->threads_executing = true;
@@ -2231,7 +2231,7 @@ resume_1 (enum gdb_signal sig)
target_pid_to_str (tp->ptid).c_str ());
}
- tp->suspend.stop_signal = GDB_SIGNAL_0;
+ tp->set_stop_signal (GDB_SIGNAL_0);
if (target_can_async_p ())
{
@@ -2617,31 +2617,31 @@ clear_proceed_status_thread (struct thread_info *tp)
/* If we're starting a new sequence, then the previous finished
single-step is no longer relevant. */
- if (tp->suspend.waitstatus_pending_p)
+ if (tp->has_pending_waitstatus ())
{
- if (tp->suspend.stop_reason == TARGET_STOPPED_BY_SINGLE_STEP)
+ if (tp->stop_reason () == TARGET_STOPPED_BY_SINGLE_STEP)
{
infrun_debug_printf ("pending event of %s was a finished step. "
"Discarding.",
target_pid_to_str (tp->ptid).c_str ());
- tp->suspend.waitstatus_pending_p = 0;
- tp->suspend.stop_reason = TARGET_STOPPED_BY_NO_REASON;
+ tp->clear_pending_waitstatus ();
+ tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON);
}
else
{
infrun_debug_printf
("thread %s has pending wait status %s (currently_stepping=%d).",
target_pid_to_str (tp->ptid).c_str (),
- target_waitstatus_to_string (&tp->suspend.waitstatus).c_str (),
+ target_waitstatus_to_string (&tp->pending_waitstatus ()).c_str (),
currently_stepping (tp));
}
}
/* If this signal should not be seen by program, give it zero.
Used for debugging signals. */
- if (!signal_pass_state (tp->suspend.stop_signal))
- tp->suspend.stop_signal = GDB_SIGNAL_0;
+ if (!signal_pass_state (tp->stop_signal ()))
+ tp->set_stop_signal (GDB_SIGNAL_0);
delete tp->thread_fsm;
tp->thread_fsm = NULL;
@@ -2802,7 +2802,7 @@ maybe_set_commit_resumed_all_targets ()
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->has_pending_waitstatus ())
{
has_thread_with_pending_status = true;
break;
@@ -3095,7 +3095,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
if (addr == (CORE_ADDR) -1)
{
- if (pc == cur_thr->suspend.stop_pc
+ if (pc == cur_thr->stop_pc ()
&& breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
&& execution_direction != EXEC_REVERSE)
/* There is a breakpoint at the address we will resume at,
@@ -3120,7 +3120,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
}
if (siggnal != GDB_SIGNAL_DEFAULT)
- cur_thr->suspend.stop_signal = siggnal;
+ cur_thr->set_stop_signal (siggnal);
/* If an exception is thrown from this point on, make sure to
propagate GDB's knowledge of the executing state to the
@@ -3241,7 +3241,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
{
infrun_debug_printf ("[%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
- gdb_assert (tp->executing || tp->suspend.waitstatus_pending_p);
+ gdb_assert (tp->executing || tp->has_pending_waitstatus ());
continue;
}
@@ -3386,11 +3386,12 @@ infrun_thread_stop_requested (ptid_t ptid)
know about that yet, queue a pending event, as if the
thread had just stopped now. Unless the thread already had
a pending event. */
- if (!tp->suspend.waitstatus_pending_p)
+ if (!tp->has_pending_waitstatus ())
{
- tp->suspend.waitstatus_pending_p = 1;
- tp->suspend.waitstatus.kind = TARGET_WAITKIND_STOPPED;
- tp->suspend.waitstatus.value.sig = GDB_SIGNAL_0;
+ target_waitstatus ws;
+ ws.kind = TARGET_WAITKIND_STOPPED;
+ ws.value.sig = GDB_SIGNAL_0;
+ tp->set_pending_waitstatus (ws);
}
/* Clear the inline-frame state, since we're re-processing the
@@ -3505,7 +3506,7 @@ random_pending_event_thread (inferior *inf, ptid_t waiton_ptid)
{
return (tp->ptid.matches (waiton_ptid)
&& tp->resumed ()
- && tp->suspend.waitstatus_pending_p);
+ && tp->has_pending_waitstatus ());
};
/* First see how many events we have. Count only resumed threads
@@ -3566,13 +3567,13 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
/* We have a specific thread to check. */
tp = find_thread_ptid (inf, ptid);
gdb_assert (tp != NULL);
- if (!tp->suspend.waitstatus_pending_p)
+ if (!tp->has_pending_waitstatus ())
tp = NULL;
}
if (tp != NULL
- && (tp->suspend.stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
- || tp->suspend.stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT))
+ && (tp->stop_reason () == TARGET_STOPPED_BY_SW_BREAKPOINT
+ || tp->stop_reason () == TARGET_STOPPED_BY_HW_BREAKPOINT))
{
struct regcache *regcache = get_thread_regcache (tp);
struct gdbarch *gdbarch = regcache->arch ();
@@ -3581,11 +3582,11 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
pc = regcache_read_pc (regcache);
- if (pc != tp->suspend.stop_pc)
+ if (pc != tp->stop_pc ())
{
infrun_debug_printf ("PC of %s changed. was=%s, now=%s",
target_pid_to_str (tp->ptid).c_str (),
- paddress (gdbarch, tp->suspend.stop_pc),
+ paddress (gdbarch, tp->stop_pc ()),
paddress (gdbarch, pc));
discard = 1;
}
@@ -3603,8 +3604,11 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
infrun_debug_printf ("pending event of %s cancelled.",
target_pid_to_str (tp->ptid).c_str ());
- tp->suspend.waitstatus.kind = TARGET_WAITKIND_SPURIOUS;
- tp->suspend.stop_reason = TARGET_STOPPED_BY_NO_REASON;
+ tp->clear_pending_waitstatus ();
+ target_waitstatus ws;
+ ws.kind = TARGET_WAITKIND_SPURIOUS;
+ tp->set_pending_waitstatus (ws);
+ tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON);
}
}
@@ -3612,13 +3616,13 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
{
infrun_debug_printf ("Using pending wait status %s for %s.",
target_waitstatus_to_string
- (&tp->suspend.waitstatus).c_str (),
+ (&tp->pending_waitstatus ()).c_str (),
target_pid_to_str (tp->ptid).c_str ());
/* Now that we've selected our final event LWP, un-adjust its PC
if it was a software breakpoint (and the target doesn't
always adjust the PC itself). */
- if (tp->suspend.stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
+ if (tp->stop_reason () == TARGET_STOPPED_BY_SW_BREAKPOINT
&& !target_supports_stopped_by_sw_breakpoint ())
{
struct regcache *regcache;
@@ -3638,9 +3642,9 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
}
}
- tp->suspend.stop_reason = TARGET_STOPPED_BY_NO_REASON;
- *status = tp->suspend.waitstatus;
- tp->suspend.waitstatus_pending_p = 0;
+ tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON);
+ *status = tp->pending_waitstatus ();
+ tp->clear_pending_waitstatus ();
/* Wake up the event loop again, until all pending events are
processed. */
@@ -4289,7 +4293,7 @@ context_switch (execution_control_state *ecs)
static void
adjust_pc_after_break (struct thread_info *thread,
- struct target_waitstatus *ws)
+ const target_waitstatus *ws)
{
struct regcache *regcache;
struct gdbarch *gdbarch;
@@ -4517,7 +4521,7 @@ handle_syscall_event (struct execution_control_state *ecs)
regcache = get_thread_regcache (ecs->event_thread);
syscall_number = ecs->ws.value.syscall_number;
- ecs->event_thread->suspend.stop_pc = regcache_read_pc (regcache);
+ ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
if (catch_syscall_enabled () > 0
&& catching_syscall_number (syscall_number) > 0)
@@ -4526,7 +4530,7 @@ handle_syscall_event (struct execution_control_state *ecs)
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (regcache->aspace (),
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->event_thread, &ecs->ws);
if (handle_stop_requested (ecs))
@@ -4561,7 +4565,7 @@ fill_in_stop_func (struct gdbarch *gdbarch,
/* Don't care about return value; stop_func_start and stop_func_name
will both be 0 if it doesn't work. */
- find_pc_partial_function_sym (ecs->event_thread->suspend.stop_pc,
+ find_pc_partial_function_sym (ecs->event_thread->stop_pc (),
&gsi,
&ecs->stop_func_start,
&ecs->stop_func_end,
@@ -4714,8 +4718,7 @@ save_waitstatus (struct thread_info *tp, const target_waitstatus *ws)
tp->ptid.tid ());
/* Record for later. */
- tp->suspend.waitstatus = *ws;
- tp->suspend.waitstatus_pending_p = 1;
+ tp->set_pending_waitstatus (*ws);
if (ws->kind == TARGET_WAITKIND_STOPPED
&& ws->value.sig == GDB_SIGNAL_TRAP)
@@ -4724,48 +4727,28 @@ save_waitstatus (struct thread_info *tp, const target_waitstatus *ws)
const address_space *aspace = regcache->aspace ();
CORE_ADDR pc = regcache_read_pc (regcache);
- adjust_pc_after_break (tp, &tp->suspend.waitstatus);
+ adjust_pc_after_break (tp, &tp->pending_waitstatus ());
scoped_restore_current_thread restore_thread;
switch_to_thread (tp);
if (target_stopped_by_watchpoint ())
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_WATCHPOINT;
- }
+ tp->set_stop_reason (TARGET_STOPPED_BY_WATCHPOINT);
else if (target_supports_stopped_by_sw_breakpoint ()
&& target_stopped_by_sw_breakpoint ())
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_SW_BREAKPOINT;
- }
+ tp->set_stop_reason (TARGET_STOPPED_BY_SW_BREAKPOINT);
else if (target_supports_stopped_by_hw_breakpoint ()
&& target_stopped_by_hw_breakpoint ())
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_HW_BREAKPOINT;
- }
+ tp->set_stop_reason (TARGET_STOPPED_BY_HW_BREAKPOINT);
else if (!target_supports_stopped_by_hw_breakpoint ()
- && hardware_breakpoint_inserted_here_p (aspace,
- pc))
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_HW_BREAKPOINT;
- }
+ && hardware_breakpoint_inserted_here_p (aspace, pc))
+ tp->set_stop_reason (TARGET_STOPPED_BY_HW_BREAKPOINT);
else if (!target_supports_stopped_by_sw_breakpoint ()
- && software_breakpoint_inserted_here_p (aspace,
- pc))
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_SW_BREAKPOINT;
- }
+ && software_breakpoint_inserted_here_p (aspace, pc))
+ tp->set_stop_reason (TARGET_STOPPED_BY_SW_BREAKPOINT);
else if (!thread_has_single_step_breakpoints_set (tp)
&& currently_stepping (tp))
- {
- tp->suspend.stop_reason
- = TARGET_STOPPED_BY_SINGLE_STEP;
- }
+ tp->set_stop_reason (TARGET_STOPPED_BY_SINGLE_STEP);
}
}
@@ -4906,9 +4889,7 @@ handle_one (const wait_one_event &event)
&& event.ws.value.sig == GDB_SIGNAL_0)
{
/* We caught the event that we intended to catch, so
- there's no event pending. */
- t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
- t->suspend.waitstatus_pending_p = 0;
+ there's no event to save as pending. */
if (displaced_step_finish (t, GDB_SIGNAL_0)
== DISPLACED_STEP_FINISH_STATUS_NOT_EXECUTED)
@@ -4949,12 +4930,11 @@ handle_one (const wait_one_event &event)
}
regcache = get_thread_regcache (t);
- t->suspend.stop_pc = regcache_read_pc (regcache);
+ t->set_stop_pc (regcache_read_pc (regcache));
infrun_debug_printf ("saved stop_pc=%s for %s "
"(currently_stepping=%d)",
- paddress (target_gdbarch (),
- t->suspend.stop_pc),
+ paddress (target_gdbarch (), t->stop_pc ()),
target_pid_to_str (t->ptid).c_str (),
currently_stepping (t));
}
@@ -5190,8 +5170,7 @@ handle_no_resumed (struct execution_control_state *ecs)
}
if (!ignore_event
- && (thread->executing
- || thread->suspend.waitstatus_pending_p))
+ && (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
@@ -5352,7 +5331,7 @@ handle_inferior_event (struct execution_control_state *ecs)
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (regcache->aspace (),
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->event_thread, &ecs->ws);
if (handle_stop_requested (ecs))
@@ -5369,7 +5348,7 @@ handle_inferior_event (struct execution_control_state *ecs)
gdb of events. This allows the user to get control
and place breakpoints in initializer routines for
dynamically loaded objects (among other things). */
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
if (stop_on_solib_events)
{
/* Make sure we print "Stopped due to solib-event" in
@@ -5590,12 +5569,12 @@ handle_inferior_event (struct execution_control_state *ecs)
and not immediately. */
ecs->event_thread->pending_follow = ecs->ws;
- ecs->event_thread->suspend.stop_pc
- = regcache_read_pc (get_thread_regcache (ecs->event_thread));
+ ecs->event_thread->set_stop_pc
+ (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_current_regcache ()->aspace (),
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->event_thread, &ecs->ws);
if (handle_stop_requested (ecs))
@@ -5610,7 +5589,7 @@ handle_inferior_event (struct execution_control_state *ecs)
bool follow_child
= (follow_fork_mode_string == follow_fork_mode_child);
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
process_stratum_target *targ
= ecs->event_thread->inf->process_target ();
@@ -5702,12 +5681,12 @@ handle_inferior_event (struct execution_control_state *ecs)
execd thread for that case (this is a nop otherwise). */
ecs->event_thread = inferior_thread ();
- ecs->event_thread->suspend.stop_pc
- = regcache_read_pc (get_thread_regcache (ecs->event_thread));
+ ecs->event_thread->set_stop_pc
+ (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_current_regcache ()->aspace (),
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->event_thread, &ecs->ws);
/* Note that this may be referenced from inside
@@ -5721,7 +5700,7 @@ handle_inferior_event (struct execution_control_state *ecs)
/* If no catchpoint triggered for this, then keep going. */
if (!bpstat_causes_stop (ecs->event_thread->control.stop_bpstat))
{
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
keep_going (ecs);
return;
}
@@ -5758,8 +5737,8 @@ handle_inferior_event (struct execution_control_state *ecs)
infrun_debug_printf ("stopped");
delete_just_stopped_threads_single_step_breakpoints ();
- ecs->event_thread->suspend.stop_pc
- = regcache_read_pc (get_thread_regcache (inferior_thread ()));
+ ecs->event_thread->set_stop_pc
+ (regcache_read_pc (get_thread_regcache (inferior_thread ())));
if (handle_stop_requested (ecs))
return;
@@ -5809,7 +5788,7 @@ restart_threads (struct thread_info *event_thread)
{
infrun_debug_printf ("restart threads: [%s] resumed",
target_pid_to_str (tp->ptid).c_str ());
- gdb_assert (tp->executing || tp->suspend.waitstatus_pending_p);
+ gdb_assert (tp->executing || tp->has_pending_waitstatus ());
continue;
}
@@ -5822,7 +5801,7 @@ restart_threads (struct thread_info *event_thread)
}
- if (tp->suspend.waitstatus_pending_p)
+ if (tp->has_pending_waitstatus ())
{
infrun_debug_printf ("restart threads: [%s] has pending status",
target_pid_to_str (tp->ptid).c_str ());
@@ -5870,8 +5849,7 @@ static int
resumed_thread_with_pending_status (struct thread_info *tp,
void *arg)
{
- return (tp->resumed ()
- && tp->suspend.waitstatus_pending_p);
+ return tp->resumed () && tp->has_pending_waitstatus ();
}
/* Called when we get an event that may finish an in-line or
@@ -5883,8 +5861,7 @@ resumed_thread_with_pending_status (struct thread_info *tp,
static int
finish_step_over (struct execution_control_state *ecs)
{
- displaced_step_finish (ecs->event_thread,
- ecs->event_thread->suspend.stop_signal);
+ displaced_step_finish (ecs->event_thread, ecs->event_thread->stop_signal ());
bool had_step_over_info = step_over_info_valid_p ();
@@ -5961,12 +5938,11 @@ finish_step_over (struct execution_control_state *ecs)
gdb_assert (!tp->executing);
regcache = get_thread_regcache (tp);
- tp->suspend.stop_pc = regcache_read_pc (regcache);
+ tp->set_stop_pc (regcache_read_pc (regcache));
infrun_debug_printf ("saved stop_pc=%s for %s "
"(currently_stepping=%d)",
- paddress (target_gdbarch (),
- tp->suspend.stop_pc),
+ paddress (target_gdbarch (), tp->stop_pc ()),
target_pid_to_str (tp->ptid).c_str (),
currently_stepping (tp));
@@ -5999,7 +5975,7 @@ handle_signal_stop (struct execution_control_state *ecs)
gdb_assert (ecs->ws.kind == TARGET_WAITKIND_STOPPED);
- ecs->event_thread->suspend.stop_signal = ecs->ws.value.sig;
+ ecs->event_thread->set_stop_signal (ecs->ws.value.sig);
/* Do we need to clean up the state of a thread that has
completed a displaced single-step? (Doing so usually affects
@@ -6011,11 +5987,11 @@ handle_signal_stop (struct execution_control_state *ecs)
the user wanted this thread to be stopped, pretend we got a
SIG0 (generic unsignaled stop). */
if (ecs->event_thread->stop_requested
- && ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ && ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP)
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
- ecs->event_thread->suspend.stop_pc
- = regcache_read_pc (get_thread_regcache (ecs->event_thread));
+ ecs->event_thread->set_stop_pc
+ (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
context_switch (ecs);
@@ -6027,9 +6003,8 @@ handle_signal_stop (struct execution_control_state *ecs)
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
struct gdbarch *reg_gdbarch = regcache->arch ();
- infrun_debug_printf ("stop_pc=%s",
- paddress (reg_gdbarch,
- ecs->event_thread->suspend.stop_pc));
+ infrun_debug_printf
+ ("stop_pc=%s", paddress (reg_gdbarch, ecs->event_thread->stop_pc ()));
if (target_stopped_by_watchpoint ())
{
CORE_ADDR addr;
@@ -6077,13 +6052,13 @@ handle_signal_stop (struct execution_control_state *ecs)
GDB_SIGNAL_0, meaning: stopped for no particular reason
other than GDB's request. */
if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
- && (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_STOP
- || ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
- || ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_0))
+ && (ecs->event_thread->stop_signal () == GDB_SIGNAL_STOP
+ || ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
+ || ecs->event_thread->stop_signal () == GDB_SIGNAL_0))
{
stop_print_frame = true;
stop_waiting (ecs);
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
return;
}
@@ -6092,7 +6067,7 @@ handle_signal_stop (struct execution_control_state *ecs)
gdbarch = get_frame_arch (frame);
/* Pull the single step breakpoints out of the target. */
- if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
+ if (ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP)
{
struct regcache *regcache;
CORE_ADDR pc;
@@ -6124,7 +6099,7 @@ handle_signal_stop (struct execution_control_state *ecs)
}
delete_just_stopped_threads_single_step_breakpoints ();
- if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
+ if (ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& ecs->event_thread->control.trap_expected
&& ecs->event_thread->stepping_over_watchpoint)
stopped_by_watchpoint = 0;
@@ -6201,16 +6176,16 @@ handle_signal_stop (struct execution_control_state *ecs)
skip_inline_frames call would break things. Fortunately
that's an extremely unlikely scenario. */
if (!pc_at_non_inline_function (aspace,
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
&ecs->ws)
- && !(ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
+ && !(ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& ecs->event_thread->control.trap_expected
&& pc_at_non_inline_function (aspace,
ecs->event_thread->prev_pc,
&ecs->ws)))
{
stop_chain = build_bpstat_chain (aspace,
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
&ecs->ws);
skip_inline_frames (ecs->event_thread, stop_chain);
@@ -6221,7 +6196,7 @@ handle_signal_stop (struct execution_control_state *ecs)
}
}
- if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
+ if (ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& ecs->event_thread->control.trap_expected
&& gdbarch_single_step_through_delay_p (gdbarch)
&& currently_stepping (ecs->event_thread))
@@ -6262,7 +6237,7 @@ handle_signal_stop (struct execution_control_state *ecs)
handles this event. */
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_current_regcache ()->aspace (),
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->event_thread, &ecs->ws, stop_chain);
/* Following in case break condition called a
@@ -6277,7 +6252,7 @@ handle_signal_stop (struct execution_control_state *ecs)
simply make sure to ignore it if `stopped_by_watchpoint' is
set. */
- if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
+ if (ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
GDB_SIGNAL_TRAP)
&& stopped_by_watchpoint)
@@ -6309,14 +6284,14 @@ handle_signal_stop (struct execution_control_state *ecs)
/* See if the breakpoints module can explain the signal. */
random_signal
= !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
- ecs->event_thread->suspend.stop_signal);
+ ecs->event_thread->stop_signal ());
/* Maybe this was a trap for a software breakpoint that has since
been removed. */
if (random_signal && target_stopped_by_sw_breakpoint ())
{
if (gdbarch_program_breakpoint_here_p (gdbarch,
- ecs->event_thread->suspend.stop_pc))
+ ecs->event_thread->stop_pc ()))
{
struct regcache *regcache;
int decr_pc;
@@ -6335,7 +6310,7 @@ handle_signal_stop (struct execution_control_state *ecs)
(record_full_gdb_operation_disable_set ());
regcache_write_pc (regcache,
- ecs->event_thread->suspend.stop_pc + decr_pc);
+ ecs->event_thread->stop_pc () + decr_pc);
}
}
else
@@ -6358,7 +6333,7 @@ handle_signal_stop (struct execution_control_state *ecs)
/* If not, perhaps stepping/nexting can. */
if (random_signal)
- random_signal = !(ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
+ random_signal = !(ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& currently_stepping (ecs->event_thread));
/* Perhaps the thread hit a single-step breakpoint of _another_
@@ -6385,7 +6360,7 @@ handle_signal_stop (struct execution_control_state *ecs)
if (random_signal)
{
/* Signal not for debugging purposes. */
- enum gdb_signal stop_signal = ecs->event_thread->suspend.stop_signal;
+ enum gdb_signal stop_signal = ecs->event_thread->stop_signal ();
infrun_debug_printf ("random signal (%s)",
gdb_signal_to_symbol_string (stop_signal));
@@ -6397,7 +6372,7 @@ handle_signal_stop (struct execution_control_state *ecs)
to remain stopped. */
if (stop_soon != NO_STOP_QUIETLY
|| ecs->event_thread->stop_requested
- || signal_stop_state (ecs->event_thread->suspend.stop_signal))
+ || signal_stop_state (ecs->event_thread->stop_signal ()))
{
stop_waiting (ecs);
return;
@@ -6406,19 +6381,19 @@ handle_signal_stop (struct execution_control_state *ecs)
/* Notify observers the signal has "handle print" set. Note we
returned early above if stopping; normal_stop handles the
printing in that case. */
- if (signal_print[ecs->event_thread->suspend.stop_signal])
+ if (signal_print[ecs->event_thread->stop_signal ()])
{
/* The signal table tells us to print about this signal. */
target_terminal::ours_for_output ();
- gdb::observers::signal_received.notify (ecs->event_thread->suspend.stop_signal);
+ gdb::observers::signal_received.notify (ecs->event_thread->stop_signal ());
target_terminal::inferior ();
}
/* Clear the signal if it should not be passed. */
- if (signal_program[ecs->event_thread->suspend.stop_signal] == 0)
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ if (signal_program[ecs->event_thread->stop_signal ()] == 0)
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
- if (ecs->event_thread->prev_pc == ecs->event_thread->suspend.stop_pc
+ if (ecs->event_thread->prev_pc == ecs->event_thread->stop_pc ()
&& ecs->event_thread->control.trap_expected
&& ecs->event_thread->control.step_resume_breakpoint == NULL)
{
@@ -6446,8 +6421,8 @@ handle_signal_stop (struct execution_control_state *ecs)
return;
}
- if (ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_0
- && (pc_in_thread_step_range (ecs->event_thread->suspend.stop_pc,
+ if (ecs->event_thread->stop_signal () != GDB_SIGNAL_0
+ && (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
ecs->event_thread)
|| ecs->event_thread->control.step_range_end == 1)
&& frame_id_eq (get_stack_frame_id (frame),
@@ -6665,7 +6640,7 @@ process_event_stop_test (struct execution_control_state *ecs)
return;
}
fill_in_stop_func (gdbarch, ecs);
- if (ecs->event_thread->suspend.stop_pc == ecs->stop_func_start
+ if (ecs->event_thread->stop_pc () == ecs->stop_func_start
&& execution_direction == EXEC_REVERSE)
{
/* We are stepping over a function call in reverse, and just
@@ -6789,7 +6764,7 @@ process_event_stop_test (struct execution_control_state *ecs)
through a function epilogue and therefore must detect when
the current-frame changes in the middle of a line. */
- if (pc_in_thread_step_range (ecs->event_thread->suspend.stop_pc,
+ if (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
ecs->event_thread)
&& (execution_direction != EXEC_REVERSE
|| frame_id_eq (get_frame_id (frame),
@@ -6808,7 +6783,7 @@ process_event_stop_test (struct execution_control_state *ecs)
/* When stepping backward, stop at beginning of line range
(unless it's the function entry point, in which case
keep going back to the call point). */
- CORE_ADDR stop_pc = ecs->event_thread->suspend.stop_pc;
+ CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
if (stop_pc == ecs->event_thread->control.step_range_start
&& stop_pc != ecs->stop_func_start
&& execution_direction == EXEC_REVERSE)
@@ -6835,11 +6810,10 @@ process_event_stop_test (struct execution_control_state *ecs)
if (execution_direction != EXEC_REVERSE
&& ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
- && in_solib_dynsym_resolve_code (ecs->event_thread->suspend.stop_pc))
+ && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ()))
{
CORE_ADDR pc_after_resolver =
- gdbarch_skip_solib_resolver (gdbarch,
- ecs->event_thread->suspend.stop_pc);
+ gdbarch_skip_solib_resolver (gdbarch, ecs->event_thread->stop_pc ());
infrun_debug_printf ("stepped into dynsym resolve code");
@@ -6862,7 +6836,7 @@ process_event_stop_test (struct execution_control_state *ecs)
/* Step through an indirect branch thunk. */
if (ecs->event_thread->control.step_over_calls != STEP_OVER_NONE
&& gdbarch_in_indirect_branch_thunk (gdbarch,
- ecs->event_thread->suspend.stop_pc))
+ ecs->event_thread->stop_pc ()))
{
infrun_debug_printf ("stepped into indirect branch thunk");
keep_going (ecs);
@@ -6890,12 +6864,12 @@ process_event_stop_test (struct execution_control_state *ecs)
call check below as on some targets return trampolines look
like subroutine calls (MIPS16 return thunks). */
if (gdbarch_in_solib_return_trampoline (gdbarch,
- ecs->event_thread->suspend.stop_pc,
+ ecs->event_thread->stop_pc (),
ecs->stop_func_name)
&& ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
{
/* Determine where this trampoline returns. */
- CORE_ADDR stop_pc = ecs->event_thread->suspend.stop_pc;
+ CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
CORE_ADDR real_stop_pc
= gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
@@ -6947,9 +6921,9 @@ process_event_stop_test (struct execution_control_state *ecs)
&& (!frame_id_eq (ecs->event_thread->control.step_stack_frame_id,
outer_frame_id)
|| (ecs->event_thread->control.step_start_function
- != find_pc_function (ecs->event_thread->suspend.stop_pc)))))
+ != find_pc_function (ecs->event_thread->stop_pc ())))))
{
- CORE_ADDR stop_pc = ecs->event_thread->suspend.stop_pc;
+ CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
CORE_ADDR real_stop_pc;
infrun_debug_printf ("stepped into subroutine");
@@ -7107,7 +7081,7 @@ process_event_stop_test (struct execution_control_state *ecs)
if (execution_direction == EXEC_REVERSE
&& ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
{
- CORE_ADDR stop_pc = ecs->event_thread->suspend.stop_pc;
+ CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
if (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc)
|| (ecs->stop_func_start == 0
@@ -7140,7 +7114,7 @@ process_event_stop_test (struct execution_control_state *ecs)
stack of inlined frames, even if GDB actually believes that it is in a
more outer frame. This is checked for below by calls to
inline_skipped_frames. */
- stop_pc_sal = find_pc_line (ecs->event_thread->suspend.stop_pc, 0);
+ stop_pc_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
/* NOTE: tausq/2004-05-24: This if block used to be done before all
the trampoline processing logic, however, there are some trampolines
@@ -7267,7 +7241,7 @@ process_event_stop_test (struct execution_control_state *ecs)
}
bool refresh_step_info = true;
- if ((ecs->event_thread->suspend.stop_pc == stop_pc_sal.pc)
+ if ((ecs->event_thread->stop_pc () == stop_pc_sal.pc)
&& (ecs->event_thread->current_line != stop_pc_sal.line
|| ecs->event_thread->current_symtab != stop_pc_sal.symtab))
{
@@ -7362,7 +7336,7 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
/* Check if the current thread is blocked on an incomplete
step-over, interrupted by a random signal. */
if (ecs->event_thread->control.trap_expected
- && ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_TRAP)
+ && ecs->event_thread->stop_signal () != GDB_SIGNAL_TRAP)
{
infrun_debug_printf
("need to finish step-over of [%s]",
@@ -7407,8 +7381,8 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
ecs->event_thread->control.trap_expected = 0;
/* Likewise, clear the signal if it should not be passed. */
- if (!signal_program[ecs->event_thread->suspend.stop_signal])
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ if (!signal_program[ecs->event_thread->stop_signal ()])
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
if (restart_stepped_thread (ecs->target, ecs->ptid))
{
@@ -7441,7 +7415,7 @@ restart_stepped_thread (process_stratum_target *resume_target,
if (tp->state == THREAD_EXITED)
continue;
- if (tp->suspend.waitstatus_pending_p)
+ if (tp->has_pending_waitstatus ())
continue;
/* Ignore threads of processes the caller is not
@@ -7465,7 +7439,7 @@ restart_stepped_thread (process_stratum_target *resume_target,
if (tp->state == THREAD_EXITED)
continue;
- if (tp->suspend.waitstatus_pending_p)
+ if (tp->has_pending_waitstatus ())
continue;
/* Ignore threads of processes the caller is not
@@ -7516,7 +7490,7 @@ restart_after_all_stop_detach (process_stratum_target *proc_target)
/* 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->has_pending_waitstatus ())
return;
}
@@ -7583,7 +7557,7 @@ keep_going_stepped_thread (struct thread_info *tp)
reset_ecs (ecs, tp);
switch_to_thread (tp);
- tp->suspend.stop_pc = regcache_read_pc (get_thread_regcache (tp));
+ tp->set_stop_pc (regcache_read_pc (get_thread_regcache (tp)));
frame = get_current_frame ();
/* If the PC of the thread we were trying to single-step has
@@ -7599,13 +7573,13 @@ keep_going_stepped_thread (struct thread_info *tp)
This prevents us continuously moving the single-step breakpoint
forward, one instruction at a time, overstepping. */
- if (tp->suspend.stop_pc != tp->prev_pc)
+ if (tp->stop_pc () != tp->prev_pc)
{
ptid_t resume_ptid;
infrun_debug_printf ("expected thread advanced also (%s -> %s)",
paddress (target_gdbarch (), tp->prev_pc),
- paddress (target_gdbarch (), tp->suspend.stop_pc));
+ paddress (target_gdbarch (), tp->stop_pc ()));
/* Clear the info of the previous step-over, as it's no longer
valid (if the thread was trying to step over a breakpoint, it
@@ -7619,7 +7593,7 @@ keep_going_stepped_thread (struct thread_info *tp)
insert_single_step_breakpoint (get_frame_arch (frame),
get_frame_address_space (frame),
- tp->suspend.stop_pc);
+ tp->stop_pc ());
tp->set_resumed (true);
resume_ptid = internal_resume_ptid (tp->control.stepping_command);
@@ -7660,7 +7634,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
fill_in_stop_func (gdbarch, ecs);
compunit_symtab *cust
- = find_pc_compunit_symtab (ecs->event_thread->suspend.stop_pc);
+ = find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
if (cust != NULL && compunit_language (cust) != language_asm)
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
@@ -7700,7 +7674,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
ecs->stop_func_start);
}
- if (ecs->stop_func_start == ecs->event_thread->suspend.stop_pc)
+ if (ecs->stop_func_start == ecs->event_thread->stop_pc ())
{
/* We are already there: stop now. */
end_stepping_range (ecs);
@@ -7739,15 +7713,15 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
fill_in_stop_func (gdbarch, ecs);
- cust = find_pc_compunit_symtab (ecs->event_thread->suspend.stop_pc);
+ cust = find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
if (cust != NULL && compunit_language (cust) != language_asm)
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
- stop_func_sal = find_pc_line (ecs->event_thread->suspend.stop_pc, 0);
+ stop_func_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
/* OK, we're just going to keep stepping here. */
- if (stop_func_sal.pc == ecs->event_thread->suspend.stop_pc)
+ if (stop_func_sal.pc == ecs->event_thread->stop_pc ())
{
/* We're there already. Just stop stepping now. */
end_stepping_range (ecs);
@@ -8054,7 +8028,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
non-signal event (e.g., a fork); or took a signal which we
are supposed to pass through to the inferior. Simply
continue. */
- resume (ecs->event_thread->suspend.stop_signal);
+ resume (ecs->event_thread->stop_signal ());
}
else if (step_over_info_valid_p ())
{
@@ -8145,7 +8119,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
- resume (ecs->event_thread->suspend.stop_signal);
+ resume (ecs->event_thread->stop_signal ());
}
prepare_to_wait (ecs);
@@ -8159,11 +8133,11 @@ static void
keep_going (struct execution_control_state *ecs)
{
if (ecs->event_thread->control.trap_expected
- && ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
+ && ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP)
ecs->event_thread->control.trap_expected = 0;
- if (!signal_program[ecs->event_thread->suspend.stop_signal])
- ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
+ if (!signal_program[ecs->event_thread->stop_signal ()])
+ ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
keep_going_pass_signal (ecs);
}
@@ -8349,7 +8323,7 @@ print_stop_location (struct target_waitstatus *ws)
&& frame_id_eq (tp->control.step_frame_id,
get_frame_id (get_current_frame ()))
&& (tp->control.step_start_function
- == find_pc_function (tp->suspend.stop_pc)))
+ == find_pc_function (tp->stop_pc ())))
{
/* Finished step, just print source line. */
source_flag = SRC_LINE;
@@ -8545,7 +8519,7 @@ normal_stop (void)
update_thread_list ();
if (last.kind == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
- gdb::observers::signal_received.notify (inferior_thread ()->suspend.stop_signal);
+ gdb::observers::signal_received.notify (inferior_thread ()->stop_signal ());
/* As with the notification of thread events, we want to delay
notifying the user that we've switched thread context until
@@ -9134,9 +9108,10 @@ public:
infcall_suspend_state (struct gdbarch *gdbarch,
const struct thread_info *tp,
struct regcache *regcache)
- : m_thread_suspend (tp->suspend),
- m_registers (new readonly_detached_regcache (*regcache))
+ : m_registers (new readonly_detached_regcache (*regcache))
{
+ tp->save_suspend_to (m_thread_suspend);
+
gdb::unique_xmalloc_ptr<gdb_byte> siginfo_data;
if (gdbarch_get_siginfo_type_p (gdbarch))
@@ -9175,7 +9150,7 @@ public:
struct thread_info *tp,
struct regcache *regcache) const
{
- tp->suspend = m_thread_suspend;
+ tp->restore_suspend_from (m_thread_suspend);
if (m_siginfo_gdbarch == gdbarch)
{
@@ -9225,7 +9200,7 @@ save_infcall_suspend_state ()
any stop signal information. The stop signal is not useful when
starting an inferior function call, and run_inferior_call will not use
the signal due to its `proceed' call with GDB_SIGNAL_0. */
- tp->suspend.stop_signal = GDB_SIGNAL_0;
+ tp->set_stop_signal (GDB_SIGNAL_0);
return inf_state;
}