#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) 0
#endif
-/* We can't step off a permanent breakpoint in the ordinary way, because we
- can't remove it. Instead, we have to advance the PC to the next
- instruction. This macro should expand to a pointer to a function that
- does that, or zero if we have no such function. If we don't have a
- definition for it, we have to report an error. */
-#ifndef SKIP_PERMANENT_BREAKPOINT
-#define SKIP_PERMANENT_BREAKPOINT (default_skip_permanent_breakpoint)
-static void
-default_skip_permanent_breakpoint (void)
-{
- error (_("\
-The program is stopped at a permanent breakpoint, but GDB does not know\n\
-how to step past a permanent breakpoint on this architecture. Try using\n\
-a command like `return' or `jump' to continue execution."));
-}
-#endif
-
/* Convert the #defines into values. This is temporary until wfi control
flow is completely sorted out. */
-#ifndef HAVE_STEPPABLE_WATCHPOINT
-#define HAVE_STEPPABLE_WATCHPOINT 0
-#else
-#undef HAVE_STEPPABLE_WATCHPOINT
-#define HAVE_STEPPABLE_WATCHPOINT 1
-#endif
-
#ifndef CANNOT_STEP_HW_WATCHPOINTS
#define CANNOT_STEP_HW_WATCHPOINTS 0
#else
struct regcache *stop_registers;
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
/* Nonzero after stop if current stack frame should be printed. */
static int stop_print_frame;
at a permanent breakpoint; we need to step over it, but permanent
breakpoints can't be removed. So we have to test for it here. */
if (breakpoint_here_p (read_pc ()) == permanent_breakpoint_here)
- SKIP_PERMANENT_BREAKPOINT ();
+ {
+ if (gdbarch_skip_permanent_breakpoint_p (current_gdbarch))
+ gdbarch_skip_permanent_breakpoint (current_gdbarch, current_regcache);
+ else
+ error (_("\
+The program is stopped at a permanent breakpoint, but GDB does not know\n\
+how to step past a permanent breakpoint on this architecture. Try using\n\
+a command like `return' or `jump' to continue execution."));
+ }
if (SOFTWARE_SINGLE_STEP_P () && step)
{
/* Do it the hard way, w/temp breakpoints */
- SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ );
- /* ...and don't ask hardware to do it. */
- step = 0;
- /* and do not pull these breakpoints until after a `wait' in
- `wait_for_inferior' */
- singlestep_breakpoints_inserted_p = 1;
- singlestep_ptid = inferior_ptid;
- singlestep_pc = read_pc ();
+ if (SOFTWARE_SINGLE_STEP (current_regcache))
+ {
+ /* ...and don't ask hardware to do it. */
+ step = 0;
+ /* and do not pull these breakpoints until after a `wait' in
+ `wait_for_inferior' */
+ singlestep_breakpoints_inserted_p = 1;
+ singlestep_ptid = inferior_ptid;
+ singlestep_pc = read_pc ();
+ }
}
/* If there were any forks/vforks/execs that were caught and are
/* FIXME: This stuff came from switch_to_thread() in
thread.c (which should probably be a public function). */
- flush_cached_frames ();
+ reinit_frame_cache ();
registers_changed ();
stop_pc = wait_pc;
- select_frame (get_current_frame ());
}
/* We return 1 to indicate that there is a breakpoint here,
to the interface from within handle_inferior_event(). */
enum inferior_stop_reason
{
- /* We don't know why. */
- STOP_UNKNOWN,
/* Step, next, nexti, stepi finished. */
END_STEPPING_RANGE,
- /* Found breakpoint. */
- BREAKPOINT_HIT,
/* Inferior terminated by signal. */
SIGNAL_EXITED,
/* Inferior exited. */
&ecs->current_line, &ecs->current_symtab);
}
inferior_ptid = ecs->ptid;
- flush_cached_frames ();
+ reinit_frame_cache ();
}
static void
}
ecs->infwait_state = infwait_normal_state;
- flush_cached_frames ();
+ reinit_frame_cache ();
/* If it's a new process, add it to the thread database */
(LONGEST) ecs->ws.value.integer));
gdb_flush (gdb_stdout);
target_mourn_inferior ();
- singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P() */
+ singlestep_breakpoints_inserted_p = 0; /* SOFTWARE_SINGLE_STEP_P() */
stop_print_frame = 0;
stop_stepping (ecs);
return;
target_mourn_inferior ();
print_stop_reason (SIGNAL_EXITED, stop_signal);
- singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P() */
+ singlestep_breakpoints_inserted_p = 0; /* SOFTWARE_SINGLE_STEP_P() */
stop_stepping (ecs);
return;
if (!ptid_equal (ecs->ptid, inferior_ptid))
{
context_switch (ecs);
- flush_cached_frames ();
+ reinit_frame_cache ();
}
stop_pc = read_pc ();
if (!ptid_equal (ecs->ptid, inferior_ptid))
{
context_switch (ecs);
- flush_cached_frames ();
+ reinit_frame_cache ();
}
/* If no catchpoint triggered for this, then keep going. */
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
/* Pull the single step breakpoints out of the target. */
- SOFTWARE_SINGLE_STEP (0, 0);
+ remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
ecs->random_signal = 0;
if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
{
/* Pull the single step breakpoints out of the target. */
- SOFTWARE_SINGLE_STEP (0, 0);
+ remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
}
if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
{
/* Pull the single step breakpoints out of the target. */
- SOFTWARE_SINGLE_STEP (0, 0);
+ remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
}
stop_print_frame = 1;
ecs->random_signal = 0;
stopped_by_random_signal = 0;
- breakpoints_failed = 0;
if (stop_signal == TARGET_SIGNAL_TRAP
&& trap_expected
code paths as single-step - set a breakpoint at the
signal return address and then, once hit, step off that
breakpoint. */
+
insert_step_resume_breakpoint_at_frame (get_current_frame ());
ecs->step_after_step_resume_breakpoint = 1;
keep_going (ecs);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
if (breakpoints_inserted)
- {
- remove_breakpoints ();
- }
+ remove_breakpoints ();
breakpoints_inserted = 0;
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
if (step_resume_breakpoint)
{
if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: step-resume breakpoint\n");
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: step-resume breakpoint is inserted\n");
/* Having a step-resume breakpoint overrides anything
else having to do with stepping commands until
keep_going (ecs);
}
-/* Insert a "step resume breakpoint" at SR_SAL with frame ID SR_ID.
+/* Insert a "step-resume breakpoint" at SR_SAL with frame ID SR_ID.
This is used to both functions and to skip over code. */
static void
thread, so we should never be setting a new
step_resume_breakpoint when one is already active. */
gdb_assert (step_resume_breakpoint == NULL);
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: inserting step-resume breakpoint at 0x%s\n",
+ paddr_nz (sr_sal.pc));
+
step_resume_breakpoint = set_momentary_breakpoint (sr_sal, sr_id,
bp_step_resume);
if (breakpoints_inserted)
insert_breakpoints ();
}
-/* Insert a "step resume breakpoint" at RETURN_FRAME.pc. This is used
+/* Insert a "step-resume breakpoint" at RETURN_FRAME.pc. This is used
to skip a potential signal handler.
This is called with the interrupted function's frame. The signal
if (!breakpoints_inserted && !ecs->another_trap)
{
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
+ /* Stop stepping when inserting breakpoints
+ has failed. */
+ if (insert_breakpoints () != 0)
{
stop_stepping (ecs);
return;
{
switch (stop_reason)
{
- case STOP_UNKNOWN:
- /* We don't deal with these cases from handle_inferior_event()
- yet. */
- break;
case END_STEPPING_RANGE:
/* We are done with a step/next/si/ni command. */
/* For now print nothing. */
(uiout, "reason",
async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
break;
- case BREAKPOINT_HIT:
- /* We found a breakpoint. */
- /* For now print nothing. */
- break;
case SIGNAL_EXITED:
/* The inferior was terminated by a signal. */
annotate_signalled ();
bpstat_print() contains the logic deciding in detail
what to print, based on the event(s) that just occurred. */
- if (stop_print_frame && deprecated_selected_frame)
+ if (stop_print_frame)
{
int bpstat_ret;
int source_flag;
default:
internal_error (__FILE__, __LINE__, _("Unknown value."));
}
- /* For mi, have the same behavior every time we stop:
- print everything but the source line. */
- if (ui_out_is_mi_like_p (uiout))
- source_flag = LOC_AND_ADDRESS;
if (ui_out_is_mi_like_p (uiout))
ui_out_field_int (uiout, "thread-id",
inf_status->registers = regcache_dup (current_regcache);
- inf_status->selected_frame_id = get_frame_id (deprecated_selected_frame);
+ inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
return inf_status;
}