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.4.50.20111218/gdb/inferior.h
25 ===================================================================
26 --- gdb-7.4.50.20111218.orig/gdb/inferior.h 2011-10-07 14:06:46.000000000 +0200
27 +++ gdb-7.4.50.20111218/gdb/inferior.h 2011-12-18 23:40:59.257300451 +0100
28 @@ -162,7 +162,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);
43 extern ptid_t user_visible_resume_ptid (int step);
45 Index: gdb-7.4.50.20111218/gdb/infrun.c
46 ===================================================================
47 --- gdb-7.4.50.20111218.orig/gdb/infrun.c 2011-11-22 22:25:17.000000000 +0100
48 +++ gdb-7.4.50.20111218/gdb/infrun.c 2011-12-19 00:12:34.470854218 +0100
49 @@ -79,7 +79,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 @@ -1668,7 +1668,8 @@ user_visible_resume_ptid (int step)
60 else if ((scheduler_mode == schedlock_on)
61 || (scheduler_mode == schedlock_step
62 - && (step || singlestep_breakpoints_inserted_p)))
63 + && (step == RESUME_STEP_USER
64 + || singlestep_breakpoints_inserted_p)))
66 /* User-settable 'scheduler' mode requires solo thread resume. */
67 resume_ptid = inferior_ptid;
68 @@ -1686,7 +1687,7 @@ user_visible_resume_ptid (int step)
69 STEP nonzero if we should step (zero to continue instead).
70 SIG is the signal to give the inferior (zero for none). */
72 -resume (int step, enum target_signal sig)
73 +resume (enum resume_step step, enum target_signal sig)
75 int should_resume = 1;
76 struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
77 @@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig
80 fprintf_unfiltered (gdb_stdlog,
81 - "infrun: resume (step=%d, signal=%d), "
82 + "infrun: resume (step=%s, signal=%d), "
83 "trap_expected=%d, current thread [%s] at %s\n",
84 - step, sig, tp->control.trap_expected,
85 + (step == RESUME_STEP_CONTINUE
86 + ? "RESUME_STEP_CONTINUE"
87 + : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
88 + : "RESUME_STEP_NEEDED")),
89 + sig, tp->control.trap_expected,
90 target_pid_to_str (inferior_ptid),
91 paddress (gdbarch, pc));
93 @@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig
94 struct thread_info *tp;
96 struct address_space *aspace;
98 + enum resume_step resume_step = RESUME_STEP_CONTINUE;
100 /* If we're stopped at a fork/vfork, follow the branch set by the
101 "set follow-fork-mode" command; otherwise, we'll just proceed
102 @@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig
103 actually be executing the breakpoint insn anyway.
104 We'll be (un-)executing the previous instruction. */
107 + resume_step = RESUME_STEP_USER;
108 else if (gdbarch_single_step_through_delay_p (gdbarch)
109 && gdbarch_single_step_through_delay (gdbarch,
110 get_current_frame ()))
111 /* We stepped onto an instruction that needs to be stepped
112 again before re-inserting the breakpoint, do so. */
114 + resume_step = RESUME_STEP_USER;
118 @@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig
119 is required it returns TRUE and sets the current thread to
121 if (prepare_to_proceed (step))
123 + resume_step = RESUME_STEP_USER;
126 /* prepare_to_proceed may change the current thread. */
127 tp = inferior_thread ();
130 + if (resume_step == RESUME_STEP_USER)
132 tp->control.trap_expected = 1;
133 /* If displaced stepping is enabled, we can step over the
134 @@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig
135 /* Reset to normal state. */
136 init_infwait_state ();
139 + resume_step = RESUME_STEP_USER;
140 + if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
141 + resume_step = RESUME_STEP_NEEDED;
143 /* Resume inferior. */
144 - resume (oneproc || step || bpstat_should_step (), tp->suspend.stop_signal);
145 + resume (resume_step, tp->suspend.stop_signal);
147 /* Wait for it to stop (if not standalone)
148 and in any case decode why it stopped, and act accordingly. */
149 @@ -5223,13 +5233,18 @@ process_event_stop_test:
151 /* Is thread TP in the middle of single-stepping? */
154 +static enum resume_step
155 currently_stepping (struct thread_info *tp)
157 - return ((tp->control.step_range_end
158 - && tp->control.step_resume_breakpoint == NULL)
159 - || tp->control.trap_expected
160 - || bpstat_should_step ());
161 + if ((tp->control.step_range_end
162 + && tp->control.step_resume_breakpoint == NULL)
163 + || tp->control.trap_expected)
164 + return RESUME_STEP_USER;
166 + if (bpstat_should_step ())
167 + return RESUME_STEP_NEEDED;
169 + return RESUME_STEP_CONTINUE;
172 /* Returns true if any thread *but* the one passed in "data" is in the
173 Index: gdb-7.4.50.20111218/gdb/linux-nat.c
174 ===================================================================
175 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-18 23:35:23.000000000 +0100
176 +++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 00:08:41.824855353 +0100
177 @@ -3036,7 +3036,11 @@ static int
178 select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
180 if (lp->last_resume_kind == resume_step
181 - && lp->status != 0)
183 + /* We do not focus on software watchpoints as we would not catch
184 + STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
185 + as they would remain pending due to `Push back breakpoint for %s'. */
186 + && lp->step == RESUME_STEP_USER)
190 Index: gdb-7.4.50.20111218/gdb/linux-nat.h
191 ===================================================================
192 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:35:23.000000000 +0100
193 +++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-18 23:40:59.262300431 +0100
194 @@ -74,8 +74,8 @@ struct lwp_info
195 /* If non-zero, a pending wait status. */
198 - /* Non-zero if we were stepping this LWP. */
200 + /* The kind of stepping of this LWP. */
201 + enum resume_step step;
203 /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
204 be the address of a hardware watchpoint. */