1 2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
3 * inferior.h (enum resume_step): New definition.
4 (resume): Change STEP parameter type to ENUM RESUME_STEP.
5 * infrun.c (resume): Likewise. Extend debug printing of the STEP
6 parameter. Lock the scheduler only for intentional stepping.
7 (proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
8 Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
9 (currently_stepping): Change the return type to ENUM RESUME_STEP.
10 Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
11 * linux-nat.c (select_singlestep_lwp_callback): Do not focus on
12 the software watchpoint events.
13 * linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
15 2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
17 * infrun.c (proceed): RESUME_STEP initialized for non-stepping.
18 RESUME_STEP set according to STEP only at the end of the function.
20 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
24 Index: gdb-7.2.50.20110117/gdb/inferior.h
25 ===================================================================
26 --- gdb-7.2.50.20110117.orig/gdb/inferior.h 2011-01-09 04:08:56.000000000 +0100
27 +++ gdb-7.2.50.20110117/gdb/inferior.h 2011-01-17 15:48:39.000000000 +0100
28 @@ -186,7 +186,15 @@ extern void reopen_exec_file (void);
29 /* The `resume' routine should only be called in special circumstances.
30 Normally, use `proceed', which handles a lot of bookkeeping. */
32 -extern void resume (int, enum target_signal);
35 + /* currently_stepping () should return non-zero for non-continue. */
36 + RESUME_STEP_CONTINUE = 0,
37 + RESUME_STEP_USER, /* Stepping is intentional by the user. */
38 + RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
41 +extern void resume (enum resume_step, enum target_signal);
45 Index: gdb-7.2.50.20110117/gdb/infrun.c
46 ===================================================================
47 --- gdb-7.2.50.20110117.orig/gdb/infrun.c 2011-01-09 04:08:56.000000000 +0100
48 +++ gdb-7.2.50.20110117/gdb/infrun.c 2011-01-17 15:49:40.000000000 +0100
49 @@ -76,7 +76,7 @@ static int follow_fork (void);
50 static void set_schedlock_func (char *args, int from_tty,
51 struct cmd_list_element *c);
53 -static int currently_stepping (struct thread_info *tp);
54 +static enum resume_step currently_stepping (struct thread_info *tp);
56 static int currently_stepping_or_nexting_callback (struct thread_info *tp,
58 @@ -1577,7 +1577,7 @@ maybe_software_singlestep (struct gdbarc
59 STEP nonzero if we should step (zero to continue instead).
60 SIG is the signal to give the inferior (zero for none). */
62 -resume (int step, enum target_signal sig)
63 +resume (enum resume_step step, enum target_signal sig)
65 int should_resume = 1;
66 struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
67 @@ -1609,10 +1609,12 @@ resume (int step, enum target_signal sig
71 - fprintf_unfiltered (gdb_stdlog,
72 - "infrun: resume (step=%d, signal=%d), "
73 - "trap_expected=%d\n",
74 - step, sig, tp->control.trap_expected);
75 + fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%s, signal=%d), "
76 + "trap_expected=%d\n",
77 + (step == RESUME_STEP_CONTINUE ? "RESUME_STEP_CONTINUE"
78 + : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
79 + : "RESUME_STEP_NEEDED")),
80 + sig, tp->control.trap_expected);
82 /* Normally, by the time we reach `resume', the breakpoints are either
83 removed or inserted, as appropriate. The exception is if we're sitting
84 @@ -1730,9 +1732,10 @@ a command like `return' or `jump' to con
86 resume_ptid = inferior_ptid;
88 - else if ((scheduler_mode == schedlock_on)
89 + else if (scheduler_mode == schedlock_on
90 || (scheduler_mode == schedlock_step
91 - && (step || singlestep_breakpoints_inserted_p)))
92 + && (step == RESUME_STEP_USER
93 + || singlestep_breakpoints_inserted_p)))
95 /* User-settable 'scheduler' mode requires solo thread resume. */
96 resume_ptid = inferior_ptid;
97 @@ -1941,7 +1944,7 @@ proceed (CORE_ADDR addr, enum target_sig
98 struct thread_info *tp;
100 struct address_space *aspace;
102 + enum resume_step resume_step = RESUME_STEP_CONTINUE;
104 /* If we're stopped at a fork/vfork, follow the branch set by the
105 "set follow-fork-mode" command; otherwise, we'll just proceed
106 @@ -1976,13 +1979,13 @@ proceed (CORE_ADDR addr, enum target_sig
107 actually be executing the breakpoint insn anyway.
108 We'll be (un-)executing the previous instruction. */
111 + resume_step = RESUME_STEP_USER;
112 else if (gdbarch_single_step_through_delay_p (gdbarch)
113 && gdbarch_single_step_through_delay (gdbarch,
114 get_current_frame ()))
115 /* We stepped onto an instruction that needs to be stepped
116 again before re-inserting the breakpoint, do so. */
118 + resume_step = RESUME_STEP_USER;
122 @@ -2023,13 +2026,13 @@ proceed (CORE_ADDR addr, enum target_sig
123 is required it returns TRUE and sets the current thread to
125 if (prepare_to_proceed (step))
127 + resume_step = RESUME_STEP_USER;
130 /* prepare_to_proceed may change the current thread. */
131 tp = inferior_thread ();
134 + if (resume_step == RESUME_STEP_USER)
136 tp->control.trap_expected = 1;
137 /* If displaced stepping is enabled, we can step over the
138 @@ -2116,8 +2119,13 @@ proceed (CORE_ADDR addr, enum target_sig
139 /* Reset to normal state. */
140 init_infwait_state ();
143 + resume_step = RESUME_STEP_USER;
144 + if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
145 + resume_step = RESUME_STEP_NEEDED;
147 /* Resume inferior. */
148 - resume (oneproc || step || bpstat_should_step (), tp->suspend.stop_signal);
149 + resume (resume_step, tp->suspend.stop_signal);
151 /* Wait for it to stop (if not standalone)
152 and in any case decode why it stopped, and act accordingly. */
153 @@ -4957,14 +4965,19 @@ process_event_stop_test:
155 /* Is thread TP in the middle of single-stepping? */
158 +static enum resume_step
159 currently_stepping (struct thread_info *tp)
161 - return ((tp->control.step_range_end
162 - && tp->control.step_resume_breakpoint == NULL)
163 - || tp->control.trap_expected
164 - || tp->stepping_through_solib_after_catch
165 - || bpstat_should_step ());
166 + if ((tp->control.step_range_end
167 + && tp->control.step_resume_breakpoint == NULL)
168 + || tp->control.trap_expected
169 + || tp->stepping_through_solib_after_catch)
170 + return RESUME_STEP_USER;
172 + if (bpstat_should_step ())
173 + return RESUME_STEP_NEEDED;
175 + return RESUME_STEP_CONTINUE;
178 /* Returns true if any thread *but* the one passed in "data" is in the
179 Index: gdb-7.2.50.20110117/gdb/linux-nat.c
180 ===================================================================
181 --- gdb-7.2.50.20110117.orig/gdb/linux-nat.c 2011-01-17 15:47:37.000000000 +0100
182 +++ gdb-7.2.50.20110117/gdb/linux-nat.c 2011-01-17 15:48:39.000000000 +0100
183 @@ -2928,7 +2928,10 @@ count_events_callback (struct lwp_info *
185 select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
187 - if (lp->step && lp->status != 0)
188 + /* We do not focus on software watchpoints as we would not catch
189 + STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
190 + as they would remain pending due to `Push back breakpoint for %s'. */
191 + if (lp->step == RESUME_STEP_USER && lp->status != 0)
195 Index: gdb-7.2.50.20110117/gdb/linux-nat.h
196 ===================================================================
197 --- gdb-7.2.50.20110117.orig/gdb/linux-nat.h 2011-01-17 15:47:37.000000000 +0100
198 +++ gdb-7.2.50.20110117/gdb/linux-nat.h 2011-01-17 15:48:39.000000000 +0100
199 @@ -55,8 +55,8 @@ struct lwp_info
200 /* If non-zero, a pending wait status. */
203 - /* Non-zero if we were stepping this LWP. */
205 + /* The kind of stepping of this LWP. */
206 + enum resume_step step;
208 /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
209 be the address of a hardware watchpoint. */