]>
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 | ||
6ed6bacf | 24 | Index: gdb-7.2.50.20110117/gdb/inferior.h |
3a58abaf | 25 | =================================================================== |
6ed6bacf AM |
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); | |
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 | ||
6ed6bacf | 45 | Index: gdb-7.2.50.20110117/gdb/infrun.c |
3a58abaf | 46 | =================================================================== |
6ed6bacf AM |
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 | |
51a5ef0f | 49 | @@ -76,7 +76,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); | |
6ed6bacf | 58 | @@ -1577,7 +1577,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); | |
6ed6bacf AM |
67 | @@ -1609,10 +1609,12 @@ resume (int step, enum target_signal sig |
68 | } | |
3a58abaf AM |
69 | |
70 | if (debug_infrun) | |
71 | - fprintf_unfiltered (gdb_stdlog, | |
72 | - "infrun: resume (step=%d, signal=%d), " | |
73 | - "trap_expected=%d\n", | |
6ed6bacf | 74 | - step, sig, tp->control.trap_expected); |
3a58abaf AM |
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")), | |
6ed6bacf | 80 | + sig, tp->control.trap_expected); |
3a58abaf | 81 | |
51a5ef0f PS |
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 | |
6ed6bacf | 84 | @@ -1730,9 +1732,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 | { | |
6ed6bacf | 95 | /* User-settable 'scheduler' mode requires solo thread resume. */ |
3a58abaf | 96 | resume_ptid = inferior_ptid; |
6ed6bacf | 97 | @@ -1941,7 +1944,7 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf | 98 | struct thread_info *tp; |
7566401a | 99 | CORE_ADDR pc; |
51a5ef0f | 100 | struct address_space *aspace; |
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 | |
6ed6bacf | 106 | @@ -1976,13 +1979,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 | { | |
6ed6bacf | 122 | @@ -2023,13 +2026,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf | 123 | is required it returns TRUE and sets the current thread to |
6ed6bacf | 124 | the old thread. */ |
3a58abaf AM |
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 | { | |
6ed6bacf | 136 | tp->control.trap_expected = 1; |
3a58abaf | 137 | /* If displaced stepping is enabled, we can step over the |
6ed6bacf | 138 | @@ -2116,8 +2119,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. */ | |
6ed6bacf AM |
148 | - resume (oneproc || step || bpstat_should_step (), tp->suspend.stop_signal); |
149 | + resume (resume_step, tp->suspend.stop_signal); | |
3a58abaf AM |
150 | |
151 | /* Wait for it to stop (if not standalone) | |
152 | and in any case decode why it stopped, and act accordingly. */ | |
6ed6bacf | 153 | @@ -4957,14 +4965,19 @@ process_event_stop_test: |
7566401a ER |
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 | { | |
6ed6bacf AM |
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 | |
7566401a | 169 | + || tp->stepping_through_solib_after_catch) |
3a58abaf AM |
170 | + return RESUME_STEP_USER; |
171 | + | |
172 | + if (bpstat_should_step ()) | |
173 | + return RESUME_STEP_NEEDED; | |
174 | + | |
175 | + return RESUME_STEP_CONTINUE; | |
176 | } | |
177 | ||
7566401a | 178 | /* Returns true if any thread *but* the one passed in "data" is in the |
6ed6bacf | 179 | Index: gdb-7.2.50.20110117/gdb/linux-nat.c |
3a58abaf | 180 | =================================================================== |
6ed6bacf AM |
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 * | |
3a58abaf AM |
184 | static int |
185 | select_singlestep_lwp_callback (struct lwp_info *lp, void *data) | |
186 | { | |
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) | |
192 | return 1; | |
193 | else | |
194 | return 0; | |
6ed6bacf | 195 | Index: gdb-7.2.50.20110117/gdb/linux-nat.h |
3a58abaf | 196 | =================================================================== |
6ed6bacf AM |
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 | |
3a58abaf AM |
199 | @@ -55,8 +55,8 @@ struct lwp_info |
200 | /* If non-zero, a pending wait status. */ | |
201 | int status; | |
202 | ||
203 | - /* Non-zero if we were stepping this LWP. */ | |
204 | - int step; | |
205 | + /* The kind of stepping of this LWP. */ | |
206 | + enum resume_step step; | |
207 | ||
208 | /* Non-zero si_signo if this LWP stopped with a trap. si_addr may | |
209 | be the address of a hardware watchpoint. */ |