preserve the stepping state in the fork child. */
if (follow_child && should_resume)
{
- step_resume_breakpoint
- = clone_momentary_breakpoint (tp->step_resume_breakpoint);
+ step_resume_breakpoint = clone_momentary_breakpoint
+ (tp->control.step_resume_breakpoint);
step_range_start = tp->control.step_range_start;
step_range_end = tp->control.step_range_end;
step_frame_id = tp->control.step_frame_id;
if (should_resume)
{
tp = inferior_thread ();
- tp->step_resume_breakpoint = step_resume_breakpoint;
+ tp->control.step_resume_breakpoint
+ = step_resume_breakpoint;
tp->control.step_range_start = step_range_start;
tp->control.step_range_end = step_range_end;
tp->control.step_frame_id = step_frame_id;
"threads". We must update the bp's notion of which thread
it is for, or it'll be ignored when it triggers. */
- if (tp->step_resume_breakpoint)
- breakpoint_re_set_thread (tp->step_resume_breakpoint);
+ if (tp->control.step_resume_breakpoint)
+ breakpoint_re_set_thread (tp->control.step_resume_breakpoint);
/* Reinsert all breakpoints in the child. The user may have set
breakpoints after catching the fork, in which case those
/* If there was one, it's gone now. We cannot truly step-to-next
statement through an exec(). */
- th->step_resume_breakpoint = NULL;
+ th->control.step_resume_breakpoint = NULL;
th->control.step_range_start = 0;
th->control.step_range_end = 0;
|| stopped_by_watchpoint
|| ecs->event_thread->control.trap_expected
|| (ecs->event_thread->control.step_range_end
- && ecs->event_thread->step_resume_breakpoint == NULL));
+ && (ecs->event_thread->control.step_resume_breakpoint
+ == NULL)));
else
{
ecs->random_signal = !bpstat_explains_signal
if (ecs->event_thread->prev_pc == stop_pc
&& ecs->event_thread->control.trap_expected
- && ecs->event_thread->step_resume_breakpoint == NULL)
+ && ecs->event_thread->control.step_resume_breakpoint == NULL)
{
/* We were just starting a new sequence, attempting to
single-step off of a breakpoint and expecting a SIGTRAP.
&& stop_pc < ecs->event_thread->control.step_range_end)
&& frame_id_eq (get_stack_frame_id (frame),
ecs->event_thread->control.step_stack_frame_id)
- && ecs->event_thread->step_resume_breakpoint == NULL)
+ && ecs->event_thread->control.step_resume_breakpoint == NULL)
{
/* The inferior is about to take a signal that will take it
out of the single step range. Set a breakpoint at the
fprintf_unfiltered (gdb_stdlog,
"infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
- gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
+ gdb_assert (ecs->event_thread->control.step_resume_breakpoint
+ != NULL);
delete_step_resume_breakpoint (ecs->event_thread);
ecs->event_thread->control.stop_step = 1;
return;
}
- if (ecs->event_thread->step_resume_breakpoint)
+ if (ecs->event_thread->control.step_resume_breakpoint)
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
static int
currently_stepping (struct thread_info *tp)
{
- return ((tp->control.step_range_end && tp->step_resume_breakpoint == NULL)
- || tp->control.trap_expected
- || tp->stepping_through_solib_after_catch
- || bpstat_should_step ());
+ return ((tp->control.step_range_end
+ && tp->control.step_resume_breakpoint == NULL)
+ || tp->control.trap_expected
+ || tp->stepping_through_solib_after_catch
+ || bpstat_should_step ());
}
/* Returns true if any thread *but* the one passed in "data" is in the
/* There should never be more than one step-resume or longjmp-resume
breakpoint per thread, so we should never be setting a new
step_resume_breakpoint when one is already active. */
- gdb_assert (inferior_thread ()->step_resume_breakpoint == NULL);
+ gdb_assert (inferior_thread ()->control.step_resume_breakpoint == NULL);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: inserting step-resume breakpoint at %s\n",
paddress (gdbarch, sr_sal.pc));
- inferior_thread ()->step_resume_breakpoint
+ inferior_thread ()->control.step_resume_breakpoint
= set_momentary_breakpoint (gdbarch, sr_sal, sr_id, bp_step_resume);
}
/* There should never be more than one step-resume or longjmp-resume
breakpoint per thread, so we should never be setting a new
longjmp_resume_breakpoint when one is already active. */
- gdb_assert (inferior_thread ()->step_resume_breakpoint == NULL);
+ gdb_assert (inferior_thread ()->control.step_resume_breakpoint == NULL);
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: inserting longjmp-resume breakpoint at %s\n",
paddress (gdbarch, pc));
- inferior_thread ()->step_resume_breakpoint =
+ inferior_thread ()->control.step_resume_breakpoint =
set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
}
inf_status->thread_control = tp->control;
inf_status->inferior_control = inf->control;
+ tp->control.step_resume_breakpoint = NULL;
+
/* Save original bpstat chain to INF_STATUS; replace it in TP with copy of
chain. If caller's caller is walking the chain, they'll be happier if we
hand them back the original chain when restore_infcall_control_state is
struct thread_info *tp = inferior_thread ();
struct inferior *inf = current_inferior ();
+ if (tp->control.step_resume_breakpoint)
+ tp->control.step_resume_breakpoint->disposition = disp_del_at_next_stop;
+
/* Handle the bpstat_copy of the chain. */
bpstat_clear (&tp->control.stop_bpstat);
void
discard_infcall_control_state (struct infcall_control_state *inf_status)
{
+ if (inf_status->thread_control.step_resume_breakpoint)
+ inf_status->thread_control.step_resume_breakpoint->disposition
+ = disp_del_at_next_stop;
+
/* See save_infcall_control_state for info on stop_bpstat. */
bpstat_clear (&inf_status->thread_control.stop_bpstat);
+
xfree (inf_status);
}
\f
--- /dev/null
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile "step-resume-infcall"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test "step" " in-func .*"
+gdb_test "up" " call-func .*"
+gdb_test_no_output {set $b=$pc}
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint {*$b if cond ()}
+
+set test {print $bpnum}
+gdb_test_multiple $test $test {
+ -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
+ set caller_bp $expect_out(1,string)
+ pass $test
+ }
+}
+
+# Debug only:
+gdb_test "disass/m" ".*"
+gdb_test "info breakpoints" ".*"
+
+gdb_test "next" "Breakpoint $caller_bp, .* call-func .*"
+
+# `cond-hit' is now hit twice; but it may not be in the future. It is
+# currently not a bug so it is not KFAILed.
+gdb_test "p cond_hit" { = [12]}