#include "frame.h"
#include "inferior.h"
#include "breakpoint.h"
-#include "common/gdb_wait.h"
+#include "gdbsupport/gdb_wait.h"
#include "gdbcore.h"
#include "gdbcmd.h"
#include "cli/cli-script.h"
#include "solist.h"
#include "event-loop.h"
#include "thread-fsm.h"
-#include "common/enum-flags.h"
+#include "gdbsupport/enum-flags.h"
#include "progspace-and-thread.h"
-#include "common/gdb_optional.h"
+#include "gdbsupport/gdb_optional.h"
#include "arch-utils.h"
-#include "common/scope-exit.h"
-#include "common/forward-scope-exit.h"
+#include "gdbsupport/scope-exit.h"
+#include "gdbsupport/forward-scope-exit.h"
/* Prototypes for local functions */
fprintf_filtered (gdb_stdlog,
_("[Detaching after %s from child %s]\n"),
has_vforked ? "vfork" : "fork",
- target_pid_to_str (process_ptid));
+ target_pid_to_str (process_ptid).c_str ());
}
}
else
fprintf_filtered (gdb_stdlog,
_("[Detaching after fork from "
"parent %s]\n"),
- target_pid_to_str (process_ptid));
+ target_pid_to_str (process_ptid).c_str ());
}
target_detach (parent_inf, 0);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: resuming vfork parent thread %s\n",
- target_pid_to_str (thread->ptid));
+ target_pid_to_str (thread->ptid).c_str ());
switch_to_thread (thread);
clear_proceed_status (0);
int resume_parent = -1;
/* This exec or exit marks the end of the shared memory region
- between the parent and the child. If the user wanted to
- detach from the parent, now is the time. */
+ between the parent and the child. Break the bonds. */
+ inferior *vfork_parent = inf->vfork_parent;
+ inf->vfork_parent->vfork_child = NULL;
+ inf->vfork_parent = NULL;
- if (inf->vfork_parent->pending_detach)
+ /* If the user wanted to detach from the parent, now is the
+ time. */
+ if (vfork_parent->pending_detach)
{
struct thread_info *tp;
struct program_space *pspace;
/* follow-fork child, detach-on-fork on. */
- inf->vfork_parent->pending_detach = 0;
+ vfork_parent->pending_detach = 0;
gdb::optional<scoped_restore_exited_inferior>
maybe_restore_inferior;
maybe_restore_thread.emplace ();
/* We're letting loose of the parent. */
- tp = any_live_thread_of_inferior (inf->vfork_parent);
+ tp = any_live_thread_of_inferior (vfork_parent);
switch_to_thread (tp);
/* We're about to detach from the parent, which implicitly
if (print_inferior_events)
{
- const char *pidstr
- = target_pid_to_str (ptid_t (inf->vfork_parent->pid));
+ std::string pidstr
+ = target_pid_to_str (ptid_t (vfork_parent->pid));
target_terminal::ours_for_output ();
{
fprintf_filtered (gdb_stdlog,
_("[Detaching vfork parent %s "
- "after child exec]\n"), pidstr);
+ "after child exec]\n"), pidstr.c_str ());
}
else
{
fprintf_filtered (gdb_stdlog,
_("[Detaching vfork parent %s "
- "after child exit]\n"), pidstr);
+ "after child exit]\n"), pidstr.c_str ());
}
}
- target_detach (inf->vfork_parent, 0);
+ target_detach (vfork_parent, 0);
/* Put it back. */
inf->pspace = pspace;
inf->removable = 1;
set_current_program_space (inf->pspace);
- resume_parent = inf->vfork_parent->pid;
-
- /* Break the bonds. */
- inf->vfork_parent->vfork_child = NULL;
+ resume_parent = vfork_parent->pid;
}
else
{
set_current_program_space (pspace);
inf->removable = 1;
inf->symfile_flags = SYMFILE_NO_READ;
- clone_program_space (pspace, inf->vfork_parent->pspace);
+ clone_program_space (pspace, vfork_parent->pspace);
inf->pspace = pspace;
inf->aspace = pspace->aspace;
- resume_parent = inf->vfork_parent->pid;
- /* Break the bonds. */
- inf->vfork_parent->vfork_child = NULL;
+ resume_parent = vfork_parent->pid;
}
- inf->vfork_parent = NULL;
-
gdb_assert (current_program_space == inf->pspace);
if (non_stop && resume_parent != -1)
/* EXEC_FILE_TARGET is assumed to be non-NULL. */
static void
-follow_exec (ptid_t ptid, char *exec_file_target)
+follow_exec (ptid_t ptid, const char *exec_file_target)
{
struct inferior *inf = current_inferior ();
int pid = ptid.pid ();
ptid_t process_ptid;
+ /* Switch terminal for any messages produced e.g. by
+ breakpoint_re_set. */
+ target_terminal::ours_for_output ();
+
/* This is an exec event that we actually wish to pay attention to.
Refresh our symbol table to the newly exec'd program, remove any
momentary bp's, etc.
/* What is this a.out's name? */
process_ptid = ptid_t (pid);
printf_unfiltered (_("%s is executing new program: %s\n"),
- target_pid_to_str (process_ptid),
+ target_pid_to_str (process_ptid).c_str (),
exec_file_target);
/* We've followed the inferior through an exec. Therefore, the
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: deferring step of %s\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
thread_step_over_chain_enqueue (tp);
return 0;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: stepping %s now\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
}
displaced_step_clear (displaced);
{
int prepared = -1;
- TRY
+ try
{
prepared = displaced_step_prepare_throw (thread);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
struct displaced_step_inferior_state *displaced_state;
if (ex.error != MEMORY_ERROR
&& ex.error != NOT_SUPPORTED_ERROR)
- throw_exception (ex);
+ throw;
if (debug_infrun)
{
fprintf_unfiltered (gdb_stdlog,
"infrun: disabling displaced stepping: %s\n",
- ex.message);
+ ex.what ());
}
/* Be verbose if "set displaced-stepping" is "on", silent if
if (can_use_displaced_stepping == AUTO_BOOLEAN_TRUE)
{
warning (_("disabling displaced stepping: %s"),
- ex.message);
+ ex.what ());
}
/* Disable further displaced stepping attempts. */
= get_displaced_stepping_state (thread->inf);
displaced_state->failed_before = 1;
}
- END_CATCH
return prepared;
}
displaced->step_saved_copy.data (), len);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: restored %s %s\n",
- target_pid_to_str (ptid),
+ target_pid_to_str (ptid).c_str (),
paddress (displaced->step_gdbarch,
displaced->step_copy));
}
internal_error (__FILE__, __LINE__,
"[%s] has inconsistent state: "
"trap_expected=%d, resumed=%d, executing=%d\n",
- target_pid_to_str (tp->ptid),
+ target_pid_to_str (tp->ptid).c_str (),
tp->control.trap_expected,
tp->resumed,
tp->executing);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: resuming [%s] for step-over\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
/* keep_going_pass_signal skips the step-over if the breakpoint
is no longer inserted. In all-stop, we want to keep looking
fprintf_unfiltered (gdb_stdlog,
"infrun: resume: thread %s has pending wait "
"status %s (currently_stepping=%d).\n",
- target_pid_to_str (tp->ptid), statstr.c_str (),
+ target_pid_to_str (tp->ptid).c_str (),
+ statstr.c_str (),
currently_stepping (tp));
}
if (sig != GDB_SIGNAL_0)
{
warning (_("Couldn't deliver signal %s to %s."),
- gdb_signal_to_name (sig), target_pid_to_str (tp->ptid));
+ gdb_signal_to_name (sig),
+ target_pid_to_str (tp->ptid).c_str ());
}
tp->suspend.stop_signal = GDB_SIGNAL_0;
"trap_expected=%d, current thread [%s] at %s\n",
step, gdb_signal_to_symbol_string (sig),
tp->control.trap_expected,
- target_pid_to_str (inferior_ptid),
+ target_pid_to_str (inferior_ptid).c_str (),
paddress (gdbarch, pc));
/* Normally, by the time we reach `resume', the breakpoints are either
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: resume: [%s] stepped breakpoint\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
tp->stepped_breakpoint = 1;
static void
resume (gdb_signal sig)
{
- TRY
+ try
{
resume_1 (sig);
}
- CATCH (ex, RETURN_MASK_ALL)
+ catch (const gdb_exception &ex)
{
/* If resuming is being aborted for any reason, delete any
single-step breakpoint resume_1 may have created, to avoid
we're running in non-stop mode. */
if (inferior_ptid != null_ptid)
delete_single_step_breakpoints (inferior_thread ());
- throw_exception (ex);
+ throw;
}
- END_CATCH
}
\f
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: clear_proceed_status_thread (%s)\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
/* If we're starting a new sequence, then the previous finished
single-step is no longer relevant. */
"infrun: clear_proceed_status: pending "
"event of %s was a finished step. "
"Discarding.\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
tp->suspend.waitstatus_pending_p = 0;
tp->suspend.stop_reason = TARGET_STOPPED_BY_NO_REASON;
"infrun: clear_proceed_status_thread: thread %s "
"has pending wait status %s "
"(currently_stepping=%d).\n",
- target_pid_to_str (tp->ptid), statstr.c_str (),
+ target_pid_to_str (tp->ptid).c_str (),
+ statstr.c_str (),
currently_stepping (tp));
}
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: need to step-over [%s] first\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
thread_step_over_chain_enqueue (tp);
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: proceed: [%s] resumed\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
gdb_assert (tp->executing || tp->suspend.waitstatus_pending_p);
continue;
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: proceed: [%s] needs step-over\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
continue;
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: proceed: resuming %s\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
reset_ecs (ecs, tp);
switch_to_thread (tp);
waiton_ptid.lwp (),
waiton_ptid.tid ());
if (waiton_ptid.pid () != -1)
- stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
+ stb.printf (" [%s]", target_pid_to_str (waiton_ptid).c_str ());
stb.printf (", status) =\n");
stb.printf ("infrun: %d.%ld.%ld [%s],\n",
result_ptid.pid (),
result_ptid.lwp (),
result_ptid.tid (),
- target_pid_to_str (result_ptid));
+ target_pid_to_str (result_ptid).c_str ());
stb.printf ("infrun: %s\n", status_string.c_str ());
/* This uses %s in part to handle %'s in the text, but also to avoid
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: Waiting for specific thread %s.\n",
- target_pid_to_str (ptid));
+ target_pid_to_str (ptid).c_str ());
/* We have a specific thread to check. */
tp = find_thread_ptid (ptid);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: PC of %s changed. was=%s, now=%s\n",
- target_pid_to_str (tp->ptid),
+ target_pid_to_str (tp->ptid).c_str (),
paddress (gdbarch, tp->suspend.stop_pc),
paddress (gdbarch, pc));
discard = 1;
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: previous breakpoint of %s, at %s gone\n",
- target_pid_to_str (tp->ptid),
+ target_pid_to_str (tp->ptid).c_str (),
paddress (gdbarch, pc));
discard = 1;
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: pending event of %s cancelled.\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
tp->suspend.waitstatus.kind = TARGET_WAITKIND_SPURIOUS;
tp->suspend.stop_reason = TARGET_STOPPED_BY_NO_REASON;
fprintf_unfiltered (gdb_stdlog,
"infrun: Using pending wait status %s for %s.\n",
statstr.c_str (),
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
}
/* Now that we've selected our final event LWP, un-adjust its PC
&& ecs->event_thread != inferior_thread ())
{
fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
fprintf_unfiltered (gdb_stdlog, "to %s\n",
- target_pid_to_str (ecs->ptid));
+ target_pid_to_str (ecs->ptid).c_str ());
}
switch_to_thread (ecs->event_thread);
fprintf_unfiltered (gdb_stdlog,
"infrun: %s executing, "
"need stop\n",
- target_pid_to_str (t->ptid));
+ target_pid_to_str (t->ptid).c_str ());
target_stop (t->ptid);
t->stop_requested = 1;
}
fprintf_unfiltered (gdb_stdlog,
"infrun: %s executing, "
"already stopping\n",
- target_pid_to_str (t->ptid));
+ target_pid_to_str (t->ptid).c_str ());
}
if (t->stop_requested)
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: %s not executing\n",
- target_pid_to_str (t->ptid));
+ target_pid_to_str (t->ptid).c_str ());
/* The thread may be not executing, but still be
resumed with a pending status to process. */
pass = -1;
event_ptid = wait_one (&ws);
-
- if (ws.kind == TARGET_WAITKIND_NO_RESUMED)
+ if (debug_infrun)
{
- /* All resumed threads exited. */
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: stop_all_threads %s %s\n",
+ target_waitstatus_to_string (&ws).c_str (),
+ target_pid_to_str (event_ptid).c_str ());
}
- else if (ws.kind == TARGET_WAITKIND_THREAD_EXITED
- || ws.kind == TARGET_WAITKIND_EXITED
- || ws.kind == TARGET_WAITKIND_SIGNALLED)
- {
- if (debug_infrun)
- {
- ptid_t ptid = ptid_t (ws.value.integer);
- fprintf_unfiltered (gdb_stdlog,
- "infrun: %s exited while "
- "stopping threads\n",
- target_pid_to_str (ptid));
- }
+ if (ws.kind == TARGET_WAITKIND_NO_RESUMED
+ || ws.kind == TARGET_WAITKIND_THREAD_EXITED
+ || ws.kind == TARGET_WAITKIND_EXITED
+ || ws.kind == TARGET_WAITKIND_SIGNALLED)
+ {
+ /* All resumed threads exited
+ or one thread/process exited/signalled. */
}
else
{
"infrun: displaced-step of %s "
"canceled: adding back to the "
"step-over queue\n",
- target_pid_to_str (t->ptid));
+ target_pid_to_str (t->ptid).c_str ());
}
t->control.trap_expected = 0;
thread_step_over_chain_enqueue (t);
"(currently_stepping=%d)\n",
paddress (target_gdbarch (),
t->suspend.stop_pc),
- target_pid_to_str (t->ptid),
+ target_pid_to_str (t->ptid).c_str (),
currently_stepping (t));
}
}
once). */
static void
-handle_inferior_event_1 (struct execution_control_state *ecs)
+handle_inferior_event (struct execution_control_state *ecs)
{
+ /* Make sure that all temporary struct value objects that were
+ created during the handling of the event get deleted at the
+ end. */
+ scoped_value_mark free_values;
+
enum stop_kind stop_soon;
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: handle_inferior_event %s\n",
+ target_waitstatus_to_string (&ecs->ws).c_str ());
+
if (ecs->ws.kind == TARGET_WAITKIND_IGNORE)
{
/* We had an event in the inferior, but we are not interested in
not stopped, and we are ignoring the event. Another possible
circumstance is any event which the lower level knows will be
reported multiple times without an intervening resume. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_IGNORE\n");
prepare_to_wait (ecs);
return;
}
if (ecs->ws.kind == TARGET_WAITKIND_THREAD_EXITED)
{
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_EXITED\n");
prepare_to_wait (ecs);
return;
}
{
/* No unwaited-for children left. IOW, all resumed children
have exited. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_NO_RESUMED\n");
-
stop_print_frame = 0;
stop_waiting (ecs);
return;
switch (ecs->ws.kind)
{
case TARGET_WAITKIND_LOADED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_LOADED\n");
context_switch (ecs);
/* Ignore gracefully during startup of the inferior, as it might
be the shell which has just loaded some objects, otherwise
_("unhandled stop_soon: %d"), (int) stop_soon);
case TARGET_WAITKIND_SPURIOUS:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n");
if (handle_stop_requested (ecs))
return;
context_switch (ecs);
return;
case TARGET_WAITKIND_THREAD_CREATED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_CREATED\n");
if (handle_stop_requested (ecs))
return;
context_switch (ecs);
case TARGET_WAITKIND_EXITED:
case TARGET_WAITKIND_SIGNALLED:
- if (debug_infrun)
- {
- if (ecs->ws.kind == TARGET_WAITKIND_EXITED)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_EXITED\n");
- else
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SIGNALLED\n");
- }
-
inferior_ptid = ecs->ptid;
set_current_inferior (find_inferior_ptid (ecs->ptid));
set_current_program_space (current_inferior ()->pspace);
the above cases end in a continue or goto. */
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
- if (debug_infrun)
- {
- if (ecs->ws.kind == TARGET_WAITKIND_FORKED)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_FORKED\n");
- else
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_VFORKED\n");
- }
-
/* Check whether the inferior is displaced stepping. */
{
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
/* Done with the shared memory region. Re-insert breakpoints in
the parent, and keep going. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_VFORK_DONE\n");
-
context_switch (ecs);
current_inferior ()->waiting_for_vfork_done = 0;
return;
case TARGET_WAITKIND_EXECD:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECD\n");
/* Note we can't read registers yet (the stop_pc), because we
don't yet know the inferior's post-exec architecture.
/* Be careful not to try to gather much state about a thread
that's in a syscall. It's frequently a losing proposition. */
case TARGET_WAITKIND_SYSCALL_ENTRY:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
/* Getting the current syscall number. */
if (handle_syscall_event (ecs) == 0)
process_event_stop_test (ecs);
syscall. Stepping one instruction seems to get it back
into user code.) */
case TARGET_WAITKIND_SYSCALL_RETURN:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SYSCALL_RETURN\n");
if (handle_syscall_event (ecs) == 0)
process_event_stop_test (ecs);
return;
case TARGET_WAITKIND_STOPPED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_STOPPED\n");
handle_signal_stop (ecs);
return;
case TARGET_WAITKIND_NO_HISTORY:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_NO_HISTORY\n");
/* Reverse execution: target ran out of history info. */
/* Switch to the stopped thread. */
}
}
-/* A wrapper around handle_inferior_event_1, which also makes sure
- that all temporary struct value objects that were created during
- the handling of the event get deleted at the end. */
-
-static void
-handle_inferior_event (struct execution_control_state *ecs)
-{
- struct value *mark = value_mark ();
-
- handle_inferior_event_1 (ecs);
- /* Purge all temporary values created during the event handling,
- as it could be a long time before we return to the command level
- where such values would otherwise be purged. */
- value_free_to_mark (mark);
-}
-
/* Restart threads back to what they were trying to do back when we
paused them for an in-line step-over. The EVENT_THREAD thread is
ignored. */
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: "
"[%s] is event thread\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
continue;
}
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: "
"[%s] not meant to be running\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
continue;
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: [%s] resumed\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
gdb_assert (tp->executing || tp->suspend.waitstatus_pending_p);
continue;
}
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: "
"[%s] needs step-over\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
gdb_assert (!tp->resumed);
continue;
}
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: "
"[%s] has pending status\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
tp->resumed = 1;
continue;
}
internal_error (__FILE__, __LINE__,
"thread [%s] needs a step-over, but not in "
"step-over queue\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
}
if (currently_stepping (tp))
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: [%s] was stepping\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
keep_going_stepped_thread (tp);
}
else
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: restart threads: [%s] continuing\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
reset_ecs (ecs, tp);
switch_to_thread (tp);
keep_going_pass_signal (ecs);
"(currently_stepping=%d)\n",
paddress (target_gdbarch (),
tp->suspend.stop_pc),
- target_pid_to_str (tp->ptid),
+ target_pid_to_str (tp->ptid).c_str (),
currently_stepping (tp));
}
fprintf_unfiltered (gdb_stdlog,
"infrun: [%s] hit another thread's "
"single-step breakpoint\n",
- target_pid_to_str (ecs->ptid));
+ target_pid_to_str (ecs->ptid).c_str ());
}
ecs->hit_singlestep_breakpoint = 1;
}
fprintf_unfiltered (gdb_stdlog,
"infrun: [%s] hit its "
"single-step breakpoint\n",
- target_pid_to_str (ecs->ptid));
+ target_pid_to_str (ecs->ptid).c_str ());
}
}
}
{
fprintf_unfiltered (gdb_stdlog,
"infrun: need to finish step-over of [%s]\n",
- target_pid_to_str (ecs->event_thread->ptid));
+ target_pid_to_str (ecs->event_thread->ptid).c_str ());
}
keep_going (ecs);
return 1;
fprintf_unfiltered (gdb_stdlog,
"infrun: need to step [%s] over single-step "
"breakpoint\n",
- target_pid_to_str (ecs->ptid));
+ target_pid_to_str (ecs->ptid).c_str ());
}
keep_going (ecs);
return 1;
{
fprintf_unfiltered (gdb_stdlog,
"infrun: thread [%s] still needs step-over\n",
- target_pid_to_str (ecs->event_thread->ptid));
+ target_pid_to_str (ecs->event_thread->ptid).c_str ());
}
keep_going (ecs);
return 1;
internal_error (__FILE__, __LINE__,
"[%s] has inconsistent state: "
"trap_expected=%d\n",
- target_pid_to_str (tp->ptid),
+ target_pid_to_str (tp->ptid).c_str (),
tp->control.trap_expected);
}
struct frame_info *frame,
struct symbol *sym)
{
- TRY
+ try
{
struct block_symbol vsym;
struct value *value;
inferior_thread ()->control.exception_resume_breakpoint = bp;
}
}
- CATCH (e, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &e)
{
/* We want to ignore errors here. */
}
- END_CATCH
}
/* A helper for check_exception_resume that sets an
if (!func)
return;
- TRY
+ try
{
const struct block *b;
struct block_iterator iter;
}
}
}
- CATCH (e, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &e)
{
}
- END_CATCH
}
static void
fprintf_unfiltered (gdb_stdlog,
"infrun: %s has trap_expected set, "
"resuming to collect trap\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
/* We haven't yet gotten our trap, and either: intercepted a
non-signal event (e.g., a fork); or took a signal which we
fprintf_unfiltered (gdb_stdlog,
"infrun: step-over already in progress: "
"step-over for %s deferred\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
thread_step_over_chain_enqueue (tp);
}
else
fprintf_unfiltered (gdb_stdlog,
"infrun: step-over in progress: "
"resume of %s deferred\n",
- target_pid_to_str (tp->ptid));
+ target_pid_to_str (tp->ptid).c_str ());
}
}
else
stop_all_threads ();
/* Stop stepping if inserting breakpoints fails. */
- TRY
+ try
{
insert_breakpoints ();
}
- CATCH (e, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &e)
{
exception_print (gdb_stderr, e);
stop_waiting (ecs);
clear_step_over_info ();
return;
}
- END_CATCH
ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
print_exited_reason (struct ui_out *uiout, int exitstatus)
{
struct inferior *inf = current_inferior ();
- const char *pidstr = target_pid_to_str (ptid_t (inf->pid));
+ std::string pidstr = target_pid_to_str (ptid_t (inf->pid));
annotate_exited (exitstatus);
if (exitstatus)
uiout->text ("[Inferior ");
uiout->text (plongest (inf->num));
uiout->text (" (");
- uiout->text (pidstr);
+ uiout->text (pidstr.c_str ());
uiout->text (") exited with code ");
uiout->field_fmt ("exit-code", "0%o", (unsigned int) exitstatus);
uiout->text ("]\n");
uiout->text ("[Inferior ");
uiout->text (plongest (inf->num));
uiout->text (" (");
- uiout->text (pidstr);
+ uiout->text (pidstr.c_str ());
uiout->text (") exited normally]\n");
}
}
/* See infrun.h. */
void
-print_stop_event (struct ui_out *uiout)
+print_stop_event (struct ui_out *uiout, bool displays)
{
struct target_waitstatus last;
ptid_t last_ptid;
print_stop_location (&last);
/* Display the auto-display expressions. */
- do_displays ();
+ if (displays)
+ do_displays ();
}
tp = inferior_thread ();
{
target_terminal::ours_for_output ();
printf_filtered (_("[Switching to %s]\n"),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
annotate_thread_changed ();
}
previous_inferior_ptid = inferior_ptid;
{
stop_context saved_context;
- TRY
+ try
{
execute_cmd_pre_hook (stop_command);
}
- CATCH (ex, RETURN_MASK_ALL)
+ catch (const gdb_exception &ex)
{
exception_fprintf (gdb_stderr, ex,
"Error while running hook_stop:\n");
}
- END_CATCH
/* If the stop hook resumes the target, then there's no point in
trying to notify about the previous stop; its context is
/* The point of the try/catch is that if the stack is clobbered,
walking the stack might encounter a garbage pointer and
error() trying to dereference it. */
- TRY
+ try
{
restore_selected_frame (inf_status->selected_frame_id);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
exception_fprintf (gdb_stderr, ex,
"Unable to restore previously selected frame:\n");
innermost frame. */
select_frame (get_current_frame ());
}
- END_CATCH
}
delete inf_status;