#include "frame.h"
#include "inferior.h"
#include "breakpoint.h"
-#include "gdb_wait.h"
+#include "common/gdb_wait.h"
#include "gdbcore.h"
#include "gdbcmd.h"
#include "cli/cli-script.h"
#include "common/gdb_optional.h"
#include "arch-utils.h"
#include "common/scope-exit.h"
+#include "common/forward-scope-exit.h"
/* Prototypes for local functions */
/* We've followed the inferior through an exec. Therefore, the
inferior has essentially been killed & reborn. */
- gdb_flush (gdb_stdout);
-
breakpoint_init_inferior (inf_execd);
gdb::unique_xmalloc_ptr<char> exec_file_host
displaced->step_closure = NULL;
}
-static void
-displaced_step_clear_cleanup (void *arg)
-{
- struct displaced_step_inferior_state *state
- = (struct displaced_step_inferior_state *) arg;
-
- displaced_step_clear (state);
-}
+/* A cleanup that wraps displaced_step_clear. */
+using displaced_step_clear_cleanup
+ = FORWARD_SCOPE_EXIT (displaced_step_clear);
/* Dump LEN bytes at BUF in hex to FILE, followed by a newline. */
void
displaced->step_original = original;
displaced->step_copy = copy;
- cleanup *ignore_cleanups
- = make_cleanup (displaced_step_clear_cleanup, displaced);
+ {
+ displaced_step_clear_cleanup cleanup (displaced);
- /* Resume execution at the copy. */
- regcache_write_pc (regcache, copy);
+ /* Resume execution at the copy. */
+ regcache_write_pc (regcache, copy);
- discard_cleanups (ignore_cleanups);
+ cleanup.release ();
+ }
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: displaced pc to %s\n",
static int
displaced_step_fixup (thread_info *event_thread, enum gdb_signal signal)
{
- struct cleanup *old_cleanups;
struct displaced_step_inferior_state *displaced
= get_displaced_stepping_state (event_thread->inf);
int ret;
if (displaced->step_thread != event_thread)
return 0;
- old_cleanups = make_cleanup (displaced_step_clear_cleanup, displaced);
+ displaced_step_clear_cleanup cleanup (displaced);
displaced_step_restore (displaced, displaced->step_thread->ptid);
ret = -1;
}
- do_cleanups (old_cleanups);
-
- displaced->step_thread = nullptr;
-
return ret;
}
if (!signal_pass_state (tp->suspend.stop_signal))
tp->suspend.stop_signal = GDB_SIGNAL_0;
- thread_fsm_delete (tp->thread_fsm);
+ delete tp->thread_fsm;
tp->thread_fsm = NULL;
tp->control.trap_expected = 0;
{
if (ecs->event_thread != NULL
&& ecs->event_thread->thread_fsm != NULL)
- thread_fsm_clean_up (ecs->event_thread->thread_fsm,
- ecs->event_thread);
+ ecs->event_thread->thread_fsm->clean_up (ecs->event_thread);
if (!non_stop)
{
continue;
switch_to_thread (thr);
- thread_fsm_clean_up (thr->thread_fsm, thr);
+ thr->thread_fsm->clean_up (thr);
}
if (ecs->event_thread != NULL)
struct thread_fsm *thread_fsm = thr->thread_fsm;
if (thread_fsm != NULL)
- should_stop = thread_fsm_should_stop (thread_fsm, thr);
+ should_stop = thread_fsm->should_stop (thr);
}
if (!should_stop)
}
else
{
- int should_notify_stop = 1;
+ bool should_notify_stop = true;
int proceeded = 0;
clean_up_just_stopped_threads_fsms (ecs);
if (thr != NULL && thr->thread_fsm != NULL)
- {
- should_notify_stop
- = thread_fsm_should_notify_stop (thr->thread_fsm);
- }
+ should_notify_stop = thr->thread_fsm->should_notify_stop ();
if (should_notify_stop)
{
tp = inferior_thread ();
if (tp->thread_fsm != NULL
- && thread_fsm_finished_p (tp->thread_fsm))
+ && tp->thread_fsm->finished_p ())
{
struct return_value_info *rv;
- rv = thread_fsm_return_value (tp->thread_fsm);
+ rv = tp->thread_fsm->return_value ();
if (rv != NULL)
print_return_value (uiout, rv);
}
if (target_has_execution)
{
if (last.kind != TARGET_WAITKIND_SIGNALLED
- && last.kind != TARGET_WAITKIND_EXITED)
+ && last.kind != TARGET_WAITKIND_EXITED
+ && last.kind != TARGET_WAITKIND_NO_RESUMED)
/* Delete the breakpoint we stopped at, if it wants to be deleted.
Delete any breakpoint that is to be deleted at the next stop. */
breakpoint_auto_delete (inferior_thread ()->control.stop_bpstat);
sigs[signum] = 1;
}
else
- {
- printf_unfiltered (_("Not confirmed, unchanged.\n"));
- gdb_flush (gdb_stdout);
- }
+ printf_unfiltered (_("Not confirmed, unchanged.\n"));
}
break;
case GDB_SIGNAL_0: