]>
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 | ||
a7de96f0 | 24 | Index: gdb-7.4.50.20120714/gdb/inferior.h |
3a58abaf | 25 | =================================================================== |
a7de96f0 PS |
26 | --- gdb-7.4.50.20120714.orig/gdb/inferior.h 2012-06-13 20:15:05.000000000 +0200 |
27 | +++ gdb-7.4.50.20120714/gdb/inferior.h 2012-07-14 23:21:01.795161794 +0200 | |
28 | @@ -159,7 +159,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 | ||
a7de96f0 | 32 | -extern void resume (int, enum gdb_signal); |
3a58abaf AM |
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 | + | |
a7de96f0 | 41 | +extern void resume (enum resume_step, enum gdb_signal); |
3a58abaf | 42 | |
f412e1b4 | 43 | extern ptid_t user_visible_resume_ptid (int step); |
3a58abaf | 44 | |
a7de96f0 | 45 | Index: gdb-7.4.50.20120714/gdb/infrun.c |
3a58abaf | 46 | =================================================================== |
a7de96f0 PS |
47 | --- gdb-7.4.50.20120714.orig/gdb/infrun.c 2012-07-01 12:37:04.000000000 +0200 |
48 | +++ gdb-7.4.50.20120714/gdb/infrun.c 2012-07-14 23:21:01.800161767 +0200 | |
f412e1b4 | 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); | |
a7de96f0 | 58 | @@ -1672,7 +1672,8 @@ user_visible_resume_ptid (int step) |
f412e1b4 PS |
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; | |
a7de96f0 | 68 | @@ -1690,7 +1691,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 | |
a7de96f0 PS |
72 | -resume (int step, enum gdb_signal sig) |
73 | +resume (enum resume_step step, enum gdb_signal sig) | |
3a58abaf AM |
74 | { |
75 | int should_resume = 1; | |
76 | struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); | |
a7de96f0 | 77 | @@ -1723,9 +1724,13 @@ resume (int step, enum gdb_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 | ||
a7de96f0 | 93 | @@ -2102,7 +2107,7 @@ proceed (CORE_ADDR addr, enum gdb_signal |
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 | |
a7de96f0 | 102 | @@ -2142,13 +2147,13 @@ proceed (CORE_ADDR addr, enum gdb_signal |
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 | { | |
a7de96f0 | 118 | @@ -2179,13 +2184,13 @@ proceed (CORE_ADDR addr, enum gdb_signal |
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 |
a7de96f0 | 134 | @@ -2272,8 +2277,13 @@ proceed (CORE_ADDR addr, enum gdb_signal |
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. */ | |
a7de96f0 | 149 | @@ -5205,13 +5215,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 |
a7de96f0 | 173 | Index: gdb-7.4.50.20120714/gdb/linux-nat.c |
3a58abaf | 174 | =================================================================== |
a7de96f0 PS |
175 | --- gdb-7.4.50.20120714.orig/gdb/linux-nat.c 2012-07-07 14:13:56.000000000 +0200 |
176 | +++ gdb-7.4.50.20120714/gdb/linux-nat.c 2012-07-14 23:21:01.803161750 +0200 | |
177 | @@ -2982,7 +2982,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; | |
a7de96f0 | 190 | Index: gdb-7.4.50.20120714/gdb/linux-nat.h |
3a58abaf | 191 | =================================================================== |
a7de96f0 PS |
192 | --- gdb-7.4.50.20120714.orig/gdb/linux-nat.h 2012-07-06 18:52:20.000000000 +0200 |
193 | +++ gdb-7.4.50.20120714/gdb/linux-nat.h 2012-07-14 23:21:17.414075355 +0200 | |
194 | @@ -73,8 +73,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 | ||
a7de96f0 PS |
203 | /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data |
204 | watchpoint trap. */ |