/* Prototypes for local functions */
-static void info_signals_command (char *, int);
-
-static void handle_command (char *, int);
-
static void sig_print_info (enum gdb_signal);
static void sig_print_header (void);
-static void resume_cleanups (void *);
-
static int follow_fork (void);
static int follow_fork_inferior (int follow_child, int detach_fork);
static void follow_inferior_reset_breakpoints (void);
-static void set_schedlock_func (char *args, int from_tty,
- struct cmd_list_element *c);
-
static int currently_stepping (struct thread_info *tp);
void nullify_last_target_wait_ptid (void);
}
static void
-set_disable_randomization (char *args, int from_tty,
+set_disable_randomization (const char *args, int from_tty,
struct cmd_list_element *c)
{
if (!target_supports_disable_randomization ())
static int non_stop_1 = 0;
static void
-set_non_stop (char *args, int from_tty,
+set_non_stop (const char *args, int from_tty,
struct cmd_list_element *c)
{
if (target_has_execution)
static int observer_mode_1 = 0;
static void
-set_observer_mode (char *args, int from_tty,
+set_observer_mode (const char *args, int from_tty,
struct cmd_list_element *c)
{
if (target_has_execution)
as appropriate when the above flag is changed. */
static void
-set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c)
+set_stop_on_solib_events (const char *args,
+ int from_tty, struct cmd_list_element *c)
{
update_solib_breakpoints ();
}
and address of the instruction the breakpoint is set at. We'll
skip inserting all breakpoints here. Valid iff ASPACE is
non-NULL. */
- struct address_space *aspace;
+ const address_space *aspace;
CORE_ADDR address;
/* The instruction being stepped over triggers a nonsteppable
because when we need the info later the thread may be running. */
static void
-set_step_over_info (struct address_space *aspace, CORE_ADDR address,
+set_step_over_info (const address_space *aspace, CORE_ADDR address,
int nonsteppable_watchpoint_p,
int thread)
{
struct thread_info *tp = find_thread_ptid (ptid);
struct regcache *regcache = get_thread_regcache (ptid);
struct gdbarch *gdbarch = regcache->arch ();
- struct address_space *aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
CORE_ADDR original, copy;
ULONGEST len;
struct displaced_step_closure *closure;
}
\f
-/* Resuming. */
-
-/* Things to clean up if we QUIT out of resume (). */
-static void
-resume_cleanups (void *ignore)
-{
- if (!ptid_equal (inferior_ptid, null_ptid))
- delete_single_step_breakpoints (inferior_thread ());
-
- normal_stop ();
-}
static const char schedlock_off[] = "off";
static const char schedlock_on[] = "on";
}
static void
-set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c)
+set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c)
{
if (!target_can_lock_scheduler)
{
target_commit_resume ();
}
-/* Resume the inferior, but allow a QUIT. This is useful if the user
- wants to interrupt some lengthy single-stepping operation
- (for child processes, the SIGINT goes to the inferior, and so
- we get a SIGINT random_signal, but for remote debugging and perhaps
- other targets, that's not true).
+/* Resume the inferior. SIG is the signal to give the inferior
+ (GDB_SIGNAL_0 for none). */
- SIG is the signal to give the inferior (zero for none). */
void
resume (enum gdb_signal sig)
{
- struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
struct thread_info *tp = inferior_thread ();
CORE_ADDR pc = regcache_read_pc (regcache);
- struct address_space *aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
ptid_t resume_ptid;
/* This represents the user's step vs continue request. When
deciding whether "set scheduler-locking step" applies, it's the
gdb_assert (!tp->stop_requested);
gdb_assert (!thread_is_in_step_over_chain (tp));
- QUIT;
-
if (tp->suspend.waitstatus_pending_p)
{
if (debug_infrun)
}
tp->suspend.stop_signal = GDB_SIGNAL_0;
- discard_cleanups (old_cleanups);
if (target_can_async_p ())
target_async (1);
resume_ptid = internal_resume_ptid (user_step);
do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
- discard_cleanups (old_cleanups);
tp->resumed = 1;
return;
}
"Got placed in step-over queue\n");
tp->control.trap_expected = 0;
- discard_cleanups (old_cleanups);
return;
}
else if (prepared < 0)
do_target_resume (resume_ptid, step, sig);
tp->resumed = 1;
- discard_cleanups (old_cleanups);
}
\f
/* Proceeding. */
struct gdbarch *gdbarch;
struct thread_info *tp;
CORE_ADDR pc;
- struct address_space *aspace;
ptid_t resume_ptid;
struct execution_control_state ecss;
struct execution_control_state *ecs = &ecss;
regcache = get_current_regcache ();
gdbarch = regcache->arch ();
- aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
+
pc = regcache_read_pc (regcache);
tp = inferior_thread ();
inferior. */
gdb_flush (gdb_stdout);
+ /* Since we've marked the inferior running, give it the terminal. A
+ QUIT/Ctrl-C from here on is forwarded to the target (which can
+ still detect attempts to unblock a stuck connection with repeated
+ Ctrl-C from within target_pass_ctrlc). */
+ target_terminal::inferior ();
+
/* In a multi-threaded task we may select another thread and
then continue or step.
{
struct regcache *regcache;
struct gdbarch *gdbarch;
- struct address_space *aspace;
CORE_ADDR breakpoint_pc, decr_pc;
/* If we've hit a breakpoint, we'll normally be stopped with SIGTRAP. If
if (decr_pc == 0)
return;
- aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
/* Find the location where (if we've hit a breakpoint) the
breakpoint would be. */
save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
{
struct regcache *regcache;
- struct address_space *aspace;
if (debug_infrun)
{
tp->suspend.waitstatus_pending_p = 1;
regcache = get_thread_regcache (tp->ptid);
- aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
if (ws->kind == TARGET_WAITKIND_STOPPED
&& ws->value.sig == GDB_SIGNAL_TRAP)
if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
{
struct regcache *regcache;
- struct address_space *aspace;
CORE_ADDR pc;
regcache = get_thread_regcache (ecs->ptid);
- aspace = regcache->aspace ();
+ const address_space *aspace = regcache->aspace ();
+
pc = regcache_read_pc (regcache);
/* However, before doing so, if this single-step breakpoint was
inline function call sites). */
if (ecs->event_thread->control.step_range_end != 1)
{
- struct address_space *aspace =
+ const address_space *aspace =
get_thread_regcache (ecs->ptid)->aspace ();
/* skip_inline_frames is expensive, so we avoid it if we can
paddress (gdbarch, sr_sal.pc));
inferior_thread ()->control.step_resume_breakpoint
- = set_momentary_breakpoint (gdbarch, sr_sal, sr_id, sr_type);
+ = set_momentary_breakpoint (gdbarch, sr_sal, sr_id, sr_type).release ();
}
void
paddress (gdbarch, pc));
inferior_thread ()->control.exception_resume_breakpoint =
- set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
+ set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume).release ();
}
/* Insert an exception resume breakpoint. TP is the thread throwing
(unsigned long) handler);
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
- handler, bp_exception_resume);
+ handler,
+ bp_exception_resume).release ();
/* set_momentary_breakpoint_at_pc invalidates FRAME. */
frame = NULL;
handler));
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
- handler, bp_exception_resume);
+ handler, bp_exception_resume).release ();
bp->thread = tp->global_num;
inferior_thread ()->control.exception_resume_breakpoint = bp;
}
CFA and the HANDLER. We ignore the CFA, extract the handler, and
set a breakpoint there. */
probe = find_probe_by_pc (get_frame_pc (frame));
- if (probe.probe)
+ if (probe.prob)
{
insert_exception_resume_from_probe (ecs->event_thread, &probe, frame);
return;
static void
keep_going_pass_signal (struct execution_control_state *ecs)
{
- /* Make sure normal_stop is called if we get a QUIT handled before
- reaching resume. */
- struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
-
gdb_assert (ptid_equal (ecs->event_thread->ptid, inferior_ptid));
gdb_assert (!ecs->event_thread->resumed);
non-signal event (e.g., a fork); or took a signal which we
are supposed to pass through to the inferior. Simply
continue. */
- discard_cleanups (old_cleanups);
resume (ecs->event_thread->suspend.stop_signal);
}
else if (step_over_info_valid_p ())
"resume of %s deferred\n",
target_pid_to_str (tp->ptid));
}
-
- discard_cleanups (old_cleanups);
}
else
{
{
exception_print (gdb_stderr, e);
stop_waiting (ecs);
- discard_cleanups (old_cleanups);
return;
}
END_CATCH
ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
- discard_cleanups (old_cleanups);
resume (ecs->event_thread->suspend.stop_signal);
}
/* Specify how various signals in the inferior should be handled. */
static void
-handle_command (char *args, int from_tty)
+handle_command (const char *args, int from_tty)
{
int digits, wordlen;
int sigfirst, signum, siglast;
targets, all signals should be in the signal tables). */
static void
-info_signals_command (char *signum_exp, int from_tty)
+info_signals_command (const char *signum_exp, int from_tty)
{
enum gdb_signal oursig;
};
static void
-set_exec_direction_func (char *args, int from_tty,
+set_exec_direction_func (const char *args, int from_tty,
struct cmd_list_element *cmd)
{
if (target_can_execute_reverse)