]>
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 | ||
f412e1b4 | 24 | Index: gdb-7.4.50.20111218/gdb/inferior.h |
3a58abaf | 25 | =================================================================== |
f412e1b4 PS |
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); | |
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 | ||
f412e1b4 | 43 | extern ptid_t user_visible_resume_ptid (int step); |
3a58abaf | 44 | |
f412e1b4 | 45 | Index: gdb-7.4.50.20111218/gdb/infrun.c |
3a58abaf | 46 | =================================================================== |
f412e1b4 PS |
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); | |
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); | |
f412e1b4 PS |
58 | @@ -1668,7 +1668,8 @@ user_visible_resume_ptid (int step) |
59 | } | |
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))) | |
65 | { | |
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) | |
3a58abaf AM |
69 | STEP nonzero if we should step (zero to continue instead). |
70 | SIG is the signal to give the inferior (zero for none). */ | |
71 | void | |
72 | -resume (int step, enum target_signal sig) | |
73 | +resume (enum resume_step step, enum target_signal sig) | |
74 | { | |
75 | int should_resume = 1; | |
76 | struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); | |
f412e1b4 | 77 | @@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig |
3a58abaf AM |
78 | |
79 | if (debug_infrun) | |
f412e1b4 | 80 | fprintf_unfiltered (gdb_stdlog, |
3a58abaf | 81 | - "infrun: resume (step=%d, signal=%d), " |
f412e1b4 PS |
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)); | |
92 | ||
93 | @@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig | |
3a58abaf | 94 | struct thread_info *tp; |
7566401a | 95 | CORE_ADDR pc; |
51a5ef0f | 96 | struct address_space *aspace; |
3a58abaf AM |
97 | - int oneproc = 0; |
98 | + enum resume_step resume_step = RESUME_STEP_CONTINUE; | |
99 | ||
7566401a ER |
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 | |
f412e1b4 | 102 | @@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf AM |
103 | actually be executing the breakpoint insn anyway. |
104 | We'll be (un-)executing the previous instruction. */ | |
105 | ||
106 | - oneproc = 1; | |
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. */ | |
113 | - oneproc = 1; | |
114 | + resume_step = RESUME_STEP_USER; | |
115 | } | |
116 | else | |
117 | { | |
f412e1b4 | 118 | @@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf | 119 | is required it returns TRUE and sets the current thread to |
6ed6bacf | 120 | the old thread. */ |
3a58abaf AM |
121 | if (prepare_to_proceed (step)) |
122 | - oneproc = 1; | |
123 | + resume_step = RESUME_STEP_USER; | |
124 | } | |
125 | ||
126 | /* prepare_to_proceed may change the current thread. */ | |
127 | tp = inferior_thread (); | |
128 | ||
129 | - if (oneproc) | |
130 | + if (resume_step == RESUME_STEP_USER) | |
131 | { | |
6ed6bacf | 132 | tp->control.trap_expected = 1; |
3a58abaf | 133 | /* If displaced stepping is enabled, we can step over the |
f412e1b4 | 134 | @@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig |
3a58abaf AM |
135 | /* Reset to normal state. */ |
136 | init_infwait_state (); | |
137 | ||
138 | + if (step) | |
139 | + resume_step = RESUME_STEP_USER; | |
140 | + if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ()) | |
141 | + resume_step = RESUME_STEP_NEEDED; | |
142 | + | |
143 | /* Resume inferior. */ | |
6ed6bacf AM |
144 | - resume (oneproc || step || bpstat_should_step (), tp->suspend.stop_signal); |
145 | + resume (resume_step, tp->suspend.stop_signal); | |
3a58abaf AM |
146 | |
147 | /* Wait for it to stop (if not standalone) | |
148 | and in any case decode why it stopped, and act accordingly. */ | |
f412e1b4 | 149 | @@ -5223,13 +5233,18 @@ process_event_stop_test: |
7566401a ER |
150 | |
151 | /* Is thread TP in the middle of single-stepping? */ | |
3a58abaf AM |
152 | |
153 | -static int | |
154 | +static enum resume_step | |
155 | currently_stepping (struct thread_info *tp) | |
156 | { | |
6ed6bacf AM |
157 | - return ((tp->control.step_range_end |
158 | - && tp->control.step_resume_breakpoint == NULL) | |
159 | - || tp->control.trap_expected | |
6ed6bacf AM |
160 | - || bpstat_should_step ()); |
161 | + if ((tp->control.step_range_end | |
162 | + && tp->control.step_resume_breakpoint == NULL) | |
f412e1b4 | 163 | + || tp->control.trap_expected) |
3a58abaf AM |
164 | + return RESUME_STEP_USER; |
165 | + | |
166 | + if (bpstat_should_step ()) | |
167 | + return RESUME_STEP_NEEDED; | |
168 | + | |
169 | + return RESUME_STEP_CONTINUE; | |
170 | } | |
171 | ||
7566401a | 172 | /* Returns true if any thread *but* the one passed in "data" is in the |
f412e1b4 | 173 | Index: gdb-7.4.50.20111218/gdb/linux-nat.c |
3a58abaf | 174 | =================================================================== |
f412e1b4 PS |
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 | |
3a58abaf AM |
178 | select_singlestep_lwp_callback (struct lwp_info *lp, void *data) |
179 | { | |
f412e1b4 PS |
180 | if (lp->last_resume_kind == resume_step |
181 | - && lp->status != 0) | |
182 | + && 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) | |
3a58abaf AM |
187 | return 1; |
188 | else | |
189 | return 0; | |
f412e1b4 | 190 | Index: gdb-7.4.50.20111218/gdb/linux-nat.h |
3a58abaf | 191 | =================================================================== |
f412e1b4 PS |
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 | |
3a58abaf AM |
195 | /* If non-zero, a pending wait status. */ |
196 | int status; | |
197 | ||
198 | - /* Non-zero if we were stepping this LWP. */ | |
199 | - int step; | |
200 | + /* The kind of stepping of this LWP. */ | |
201 | + enum resume_step step; | |
202 | ||
203 | /* Non-zero si_signo if this LWP stopped with a trap. si_addr may | |
204 | be the address of a hardware watchpoint. */ |