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-6.8.50.20090803/gdb/inferior.h
25 ===================================================================
26 --- gdb-6.8.50.20090803.orig/gdb/inferior.h 2009-06-28 02:20:22.000000000 +0200
27 +++ gdb-6.8.50.20090803/gdb/inferior.h 2009-08-03 17:19:56.000000000 +0200
28 @@ -181,7 +181,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-6.8.50.20090803/gdb/infrun.c
46 ===================================================================
47 --- gdb-6.8.50.20090803.orig/gdb/infrun.c 2009-07-31 01:01:27.000000000 +0200
48 +++ gdb-6.8.50.20090803/gdb/infrun.c 2009-08-03 21:39:28.000000000 +0200
49 @@ -74,7 +74,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 @@ -1137,7 +1137,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 @@ -1149,10 +1149,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->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->trap_expected);
82 /* Some targets (e.g. Solaris x86) have a kernel bug when stepping
83 over an instruction that causes a page fault without triggering
84 @@ -1271,9 +1273,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 @@ -1474,7 +1477,7 @@ proceed (CORE_ADDR addr, enum target_sig
98 struct gdbarch *gdbarch;
99 struct thread_info *tp;
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 @@ -1508,13 +1511,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 @@ -1545,13 +1548,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->trap_expected = 1;
137 /* If displaced stepping is enabled, we can step over the
138 @@ -1637,8 +1640,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->stop_signal);
149 + resume (resume_step, tp->stop_signal);
151 /* Wait for it to stop (if not standalone)
152 and in any case decode why it stopped, and act accordingly. */
153 @@ -4171,13 +4179,18 @@ infrun: not switching back to stepped th
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->step_range_end && tp->step_resume_breakpoint == NULL)
162 - || tp->trap_expected
163 - || tp->stepping_through_solib_after_catch
164 - || bpstat_should_step ());
165 + if ((tp->step_range_end && tp->step_resume_breakpoint == NULL)
166 + || tp->trap_expected
167 + || tp->stepping_through_solib_after_catch)
168 + return RESUME_STEP_USER;
170 + if (bpstat_should_step ())
171 + return RESUME_STEP_NEEDED;
173 + return RESUME_STEP_CONTINUE;
176 /* Returns true if any thread *but* the one passed in "data" is in the
177 Index: gdb-6.8.50.20090803/gdb/linux-nat.c
178 ===================================================================
179 --- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-07-31 17:25:21.000000000 +0200
180 +++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 21:39:10.000000000 +0200
181 @@ -2351,7 +2351,10 @@ count_events_callback (struct lwp_info *
183 select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
185 - if (lp->step && lp->status != 0)
186 + /* We do not focus on software watchpoints as we would not catch
187 + STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
188 + as they would remain pending due to `Push back breakpoint for %s'. */
189 + if (lp->step == RESUME_STEP_USER && lp->status != 0)
193 Index: gdb-6.8.50.20090803/gdb/linux-nat.h
194 ===================================================================
195 --- gdb-6.8.50.20090803.orig/gdb/linux-nat.h 2009-05-18 19:11:25.000000000 +0200
196 +++ gdb-6.8.50.20090803/gdb/linux-nat.h 2009-08-03 21:39:09.000000000 +0200
197 @@ -55,8 +55,8 @@ struct lwp_info
198 /* If non-zero, a pending wait status. */
201 - /* Non-zero if we were stepping this LWP. */
203 + /* The kind of stepping of this LWP. */
204 + enum resume_step step;
206 /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
207 be the address of a hardware watchpoint. */