]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com> |
2 | ||
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. | |
14 | ||
15 | 2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com> | |
16 | ||
17 | * infrun.c (proceed): RESUME_STEP initialized for non-stepping. | |
18 | RESUME_STEP set according to STEP only at the end of the function. | |
19 | ||
20 | 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com> | |
21 | ||
22 | Port to GDB-6.8pre. | |
23 | ||
7566401a | 24 | Index: gdb-6.8.50.20090803/gdb/inferior.h |
3a58abaf | 25 | =================================================================== |
7566401a ER |
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); | |
3a58abaf AM |
29 | /* The `resume' routine should only be called in special circumstances. |
30 | Normally, use `proceed', which handles a lot of bookkeeping. */ | |
31 | ||
32 | -extern void resume (int, enum target_signal); | |
33 | +enum resume_step | |
34 | + { | |
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. */ | |
39 | + }; | |
40 | + | |
41 | +extern void resume (enum resume_step, enum target_signal); | |
42 | ||
43 | /* From misc files */ | |
44 | ||
7566401a | 45 | Index: gdb-6.8.50.20090803/gdb/infrun.c |
3a58abaf | 46 | =================================================================== |
7566401a ER |
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); | |
3a58abaf AM |
50 | static void set_schedlock_func (char *args, int from_tty, |
51 | struct cmd_list_element *c); | |
52 | ||
53 | -static int currently_stepping (struct thread_info *tp); | |
54 | +static enum resume_step currently_stepping (struct thread_info *tp); | |
55 | ||
7566401a ER |
56 | static int currently_stepping_or_nexting_callback (struct thread_info *tp, |
57 | void *data); | |
58 | @@ -1137,7 +1137,7 @@ maybe_software_singlestep (struct gdbarc | |
3a58abaf AM |
59 | STEP nonzero if we should step (zero to continue instead). |
60 | SIG is the signal to give the inferior (zero for none). */ | |
61 | void | |
62 | -resume (int step, enum target_signal sig) | |
63 | +resume (enum resume_step step, enum target_signal sig) | |
64 | { | |
65 | int should_resume = 1; | |
66 | struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); | |
7566401a | 67 | @@ -1149,10 +1149,12 @@ resume (int step, enum target_signal sig |
3a58abaf AM |
68 | QUIT; |
69 | ||
70 | if (debug_infrun) | |
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); | |
81 | ||
82 | /* Some targets (e.g. Solaris x86) have a kernel bug when stepping | |
83 | over an instruction that causes a page fault without triggering | |
7566401a | 84 | @@ -1271,9 +1273,10 @@ a command like `return' or `jump' to con |
3a58abaf AM |
85 | individually. */ |
86 | resume_ptid = inferior_ptid; | |
87 | } | |
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))) | |
94 | { | |
95 | /* User-settable 'scheduler' mode requires solo thread resume. */ | |
96 | resume_ptid = inferior_ptid; | |
7566401a ER |
97 | @@ -1474,7 +1477,7 @@ proceed (CORE_ADDR addr, enum target_sig |
98 | struct gdbarch *gdbarch; | |
3a58abaf | 99 | struct thread_info *tp; |
7566401a | 100 | CORE_ADDR pc; |
3a58abaf AM |
101 | - int oneproc = 0; |
102 | + enum resume_step resume_step = RESUME_STEP_CONTINUE; | |
103 | ||
7566401a ER |
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 | |
3a58abaf AM |
107 | actually be executing the breakpoint insn anyway. |
108 | We'll be (un-)executing the previous instruction. */ | |
109 | ||
110 | - oneproc = 1; | |
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. */ | |
117 | - oneproc = 1; | |
118 | + resume_step = RESUME_STEP_USER; | |
119 | } | |
120 | else | |
121 | { | |
7566401a | 122 | @@ -1545,13 +1548,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf AM |
123 | is required it returns TRUE and sets the current thread to |
124 | the old thread. */ | |
125 | if (prepare_to_proceed (step)) | |
126 | - oneproc = 1; | |
127 | + resume_step = RESUME_STEP_USER; | |
128 | } | |
129 | ||
130 | /* prepare_to_proceed may change the current thread. */ | |
131 | tp = inferior_thread (); | |
132 | ||
133 | - if (oneproc) | |
134 | + if (resume_step == RESUME_STEP_USER) | |
135 | { | |
136 | tp->trap_expected = 1; | |
137 | /* If displaced stepping is enabled, we can step over the | |
7566401a | 138 | @@ -1637,8 +1640,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf AM |
139 | /* Reset to normal state. */ |
140 | init_infwait_state (); | |
141 | ||
142 | + if (step) | |
143 | + resume_step = RESUME_STEP_USER; | |
144 | + if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ()) | |
145 | + resume_step = RESUME_STEP_NEEDED; | |
146 | + | |
147 | /* Resume inferior. */ | |
148 | - resume (oneproc || step || bpstat_should_step (), tp->stop_signal); | |
149 | + resume (resume_step, tp->stop_signal); | |
150 | ||
151 | /* Wait for it to stop (if not standalone) | |
152 | and in any case decode why it stopped, and act accordingly. */ | |
7566401a ER |
153 | @@ -4171,13 +4179,18 @@ infrun: not switching back to stepped th |
154 | ||
155 | /* Is thread TP in the middle of single-stepping? */ | |
3a58abaf AM |
156 | |
157 | -static int | |
158 | +static enum resume_step | |
159 | currently_stepping (struct thread_info *tp) | |
160 | { | |
7566401a ER |
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) | |
3a58abaf AM |
168 | + return RESUME_STEP_USER; |
169 | + | |
170 | + if (bpstat_should_step ()) | |
171 | + return RESUME_STEP_NEEDED; | |
172 | + | |
173 | + return RESUME_STEP_CONTINUE; | |
174 | } | |
175 | ||
7566401a ER |
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 | |
3a58abaf | 178 | =================================================================== |
7566401a ER |
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 * | |
3a58abaf AM |
182 | static int |
183 | select_singlestep_lwp_callback (struct lwp_info *lp, void *data) | |
184 | { | |
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) | |
190 | return 1; | |
191 | else | |
192 | return 0; | |
7566401a | 193 | Index: gdb-6.8.50.20090803/gdb/linux-nat.h |
3a58abaf | 194 | =================================================================== |
7566401a ER |
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 | |
3a58abaf AM |
197 | @@ -55,8 +55,8 @@ struct lwp_info |
198 | /* If non-zero, a pending wait status. */ | |
199 | int status; | |
200 | ||
201 | - /* Non-zero if we were stepping this LWP. */ | |
202 | - int step; | |
203 | + /* The kind of stepping of this LWP. */ | |
204 | + enum resume_step step; | |
205 | ||
206 | /* Non-zero si_signo if this LWP stopped with a trap. si_addr may | |
207 | be the address of a hardware watchpoint. */ |