+2007-11-29 Vladimir Prus <vladimir@codesourcery.com>
+
+ Stop infrun from tracking breakpoint insertion status.
+
+ The checks of breakpoints_inserted before calling
+ remove_breakpoints are removed, as remove_breakpoint
+ won't touch uninserted breakpoints. In a number of places,
+ we're interested if a breakpoint is inserted at particular
+ PC, and we now use breakpoint_inserted_here_p. In a few
+ places, insert_breakpoints can be called unconditionally,
+ since it won't try to insert already inserted breakpoint.
+
+ * breakpoint.h (regular_breakpoint_inserted_here_p): New
+ declaration.
+ * breakpoint.c (regular_breakpoint_inserted_here_p): New.
+ (breakpoint_inserted_here_p): Use
+ regular_breakpoint_inserted_here_p.
+ * infrun.c (breakpoints_inserted): Remove.
+ (resume): Don't check for breakpoints_inserted before
+ remove_hw_watchpoints. Use breakpoint_inserted_here_p.
+ (proceed, init_wait_for_inferior): Don't set breakpoints_inserted.
+ (handle_inferior_event): Don't use breakpoints_inserted.
+ Use breakpoints_meant_to_be_inserted and
+ breakpoints_inserted_here_p.
+ (insert_step_resume_breakpoint_at_sal, keep_going): Use
+ breakpoints_meant_to_be_inserted. Don't set breakpoints_inserted.
+ (normal_stop): Don't check for breakpoints_inserted. Don't
+ set breakpoints_inserted.
+ (keep_going): Don't check for breakpoints_inserted.
+ (insert_step_resume_breakpoint_at_sal): Don't insert
+ breakpoints
+
2007-11-28 Jim Blandy <jimb@codesourcery.com>
* breakpoint.c (watch_command_1): When the watchpoint isn't local
static struct cmd_list_element *stop_command;
-/* Nonzero if breakpoints are now inserted in the inferior. */
-
-static int breakpoints_inserted;
-
/* Function inferior was in as of last step command. */
static struct symbol *step_start_function;
Work around the problem by removing hardware watchpoints if a step is
requested, GDB will check for a hardware watchpoint trigger after the
step anyway. */
- if (CANNOT_STEP_HW_WATCHPOINTS && step && breakpoints_inserted)
+ if (CANNOT_STEP_HW_WATCHPOINTS && step)
remove_hw_watchpoints ();
/* Most targets can step a breakpoint instruction, thus
executing it normally. But if this one cannot, just
continue and we will hit it anyway. */
- if (step && breakpoints_inserted && breakpoint_here_p (read_pc ()))
+ if (step && breakpoint_inserted_here_p (read_pc ()))
step = 0;
}
target_resume (resume_ptid, step, sig);
Continue it automatically and insert breakpoints then. */
trap_expected = 1;
else
- {
- insert_breakpoints ();
- /* If we get here there was no call to error() in
- insert breakpoints -- so they were inserted. */
- breakpoints_inserted = 1;
- }
+ insert_breakpoints ();
if (siggnal != TARGET_SIGNAL_DEFAULT)
stop_signal = siggnal;
/* These are meaningless until the first time through wait_for_inferior. */
prev_pc = 0;
- breakpoints_inserted = 0;
breakpoint_init_inferior (inf_starting);
/* Don't confuse first call to proceed(). */
established. */
if (stop_soon == NO_STOP_QUIETLY)
{
- int breakpoints_were_inserted;
-
/* Remove breakpoints, SOLIB_ADD might adjust
breakpoint addresses via breakpoint_re_set. */
- breakpoints_were_inserted = breakpoints_inserted;
- if (breakpoints_inserted)
- remove_breakpoints ();
- breakpoints_inserted = 0;
+ remove_breakpoints ();
/* Check for any newly added shared libraries if we're
supposed to be adding them automatically. Switch
for "catch load". */
/* Reinsert breakpoints and continue. */
- if (breakpoints_were_inserted)
- {
- insert_breakpoints ();
- breakpoints_inserted = 1;
- }
+ insert_breakpoints ();
}
/* If we are skipping through a shell, or through shared library
/* Check if a regular breakpoint has been hit before checking
for a potential single step breakpoint. Otherwise, GDB will
not see this breakpoint hit when stepping onto breakpoints. */
- if (breakpoints_inserted && breakpoint_here_p (stop_pc))
+ if (regular_breakpoint_inserted_here_p (stop_pc))
{
ecs->random_signal = 0;
if (!breakpoint_thread_match (stop_pc, ecs->ptid))
}
else
{ /* Single step */
- breakpoints_inserted = 0;
if (!ptid_equal (inferior_ptid, ecs->ptid))
context_switch (ecs);
ecs->waiton_ptid = ecs->ptid;
stack. */
if (stop_signal == TARGET_SIGNAL_TRAP
- || (breakpoints_inserted
+ || (breakpoint_inserted_here_p (stop_pc)
&& (stop_signal == TARGET_SIGNAL_ILL
|| stop_signal == TARGET_SIGNAL_SEGV
|| stop_signal == TARGET_SIGNAL_EMT))
stop_signal = TARGET_SIGNAL_0;
if (prev_pc == read_pc ()
- && !breakpoints_inserted
&& breakpoint_here_p (read_pc ())
+ && !breakpoint_inserted_here_p (read_pc ())
&& step_resume_breakpoint == NULL)
{
/* We were just starting a new sequence, attempting to
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME\n");
disable_longjmp_breakpoint ();
remove_breakpoints ();
- breakpoints_inserted = 0;
if (!gdbarch_get_longjmp_target_p (current_gdbarch)
|| !gdbarch_get_longjmp_target (current_gdbarch,
get_current_frame (), &jmp_buf_pc))
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
remove_breakpoints ();
- breakpoints_inserted = 0;
disable_longjmp_breakpoint ();
ecs->handling_longjmp = 0; /* FIXME */
if (what.main_action == BPSTAT_WHAT_CLEAR_LONGJMP_RESUME)
case BPSTAT_WHAT_SINGLE:
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
- if (breakpoints_inserted)
- remove_breakpoints ();
- breakpoints_inserted = 0;
+ remove_breakpoints ();
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
where we are stepping and step out of the right range. */
to doing that. */
ecs->step_after_step_resume_breakpoint = 0;
remove_breakpoints ();
- breakpoints_inserted = 0;
ecs->another_trap = 1;
keep_going (ecs);
return;
/* Remove breakpoints, we eventually want to step over the
shlib event breakpoint, and SOLIB_ADD might adjust
breakpoint addresses via breakpoint_re_set. */
- if (breakpoints_inserted)
- remove_breakpoints ();
- breakpoints_inserted = 0;
+ remove_breakpoints ();
/* Check for any newly added shared libraries if we're
supposed to be adding them automatically. Switch
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
The signal was SIGTRAP, e.g. it was our signal, but we
decided we should resume from it.
- We're going to run this baby now! */
+ We're going to run this baby now!
- if (!breakpoints_inserted && !ecs->another_trap)
+ Note that insert_breakpoints won't try to re-insert
+ already inserted breakpoints. Therefore, we don't
+ care if breakpoints were already inserted, or not. */
+
+ if (!ecs->another_trap)
{
/* Stop stepping when inserting breakpoints
has failed. */
stop_stepping (ecs);
return;
}
- breakpoints_inserted = 1;
}
trap_expected = ecs->another_trap;
gdbarch_decr_pc_after_break needs to just go away. */
deprecated_update_frame_pc_hack (get_current_frame (), read_pc ());
- if (target_has_execution && breakpoints_inserted)
+ if (target_has_execution)
{
if (remove_breakpoints ())
{
Further execution is probably impossible.\n"));
}
}
- breakpoints_inserted = 0;
/* Delete the breakpoint we stopped at, if it wants to be deleted.
Delete any breakpoint that is to be deleted at the next stop. */