]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - gdb/patches/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
Merge remote-tracking branch 'stevee/audit'
[people/ms/ipfire-3.x.git] / gdb / patches / gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
CommitLineData
5a03b7c3
MT
12007-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
152007-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
202008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
21
22 Port to GDB-6.8pre.
23
24Index: gdb-7.3.50.20110722/gdb/inferior.h
25===================================================================
26--- gdb-7.3.50.20110722.orig/gdb/inferior.h 2011-07-22 01:46:08.000000000 +0200
27+++ gdb-7.3.50.20110722/gdb/inferior.h 2011-07-22 19:13:30.000000000 +0200
28@@ -158,7 +158,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. */
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 extern ptid_t user_visible_resume_ptid (int step);
44
45Index: gdb-7.3.50.20110722/gdb/infrun.c
46===================================================================
47--- gdb-7.3.50.20110722.orig/gdb/infrun.c 2011-07-22 19:08:19.000000000 +0200
48+++ gdb-7.3.50.20110722/gdb/infrun.c 2011-07-22 19:12:56.000000000 +0200
49@@ -79,7 +79,7 @@ static int follow_fork (void);
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
56 static int currently_stepping_or_nexting_callback (struct thread_info *tp,
57 void *data);
58@@ -1630,7 +1630,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@@ -1648,7 +1649,7 @@ user_visible_resume_ptid (int step)
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);
77@@ -1681,9 +1682,13 @@ resume (int step, enum target_signal sig
78
79 if (debug_infrun)
80 fprintf_unfiltered (gdb_stdlog,
81- "infrun: resume (step=%d, signal=%d), "
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@@ -2056,7 +2061,7 @@ proceed (CORE_ADDR addr, enum target_sig
94 struct thread_info *tp;
95 CORE_ADDR pc;
96 struct address_space *aspace;
97- int oneproc = 0;
98+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
99
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
102@@ -2096,13 +2101,13 @@ proceed (CORE_ADDR addr, enum target_sig
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 {
118@@ -2133,13 +2138,13 @@ proceed (CORE_ADDR addr, enum target_sig
119 is required it returns TRUE and sets the current thread to
120 the old thread. */
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 {
132 tp->control.trap_expected = 1;
133 /* If displaced stepping is enabled, we can step over the
134@@ -2226,8 +2231,13 @@ proceed (CORE_ADDR addr, enum target_sig
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. */
144- resume (oneproc || step || bpstat_should_step (), tp->suspend.stop_signal);
145+ resume (resume_step, tp->suspend.stop_signal);
146
147 /* Wait for it to stop (if not standalone)
148 and in any case decode why it stopped, and act accordingly. */
149@@ -5123,14 +5133,19 @@ process_event_stop_test:
150
151 /* Is thread TP in the middle of single-stepping? */
152
153-static int
154+static enum resume_step
155 currently_stepping (struct thread_info *tp)
156 {
157- return ((tp->control.step_range_end
158- && tp->control.step_resume_breakpoint == NULL)
159- || tp->control.trap_expected
160- || tp->stepping_through_solib_after_catch
161- || bpstat_should_step ());
162+ if ((tp->control.step_range_end
163+ && tp->control.step_resume_breakpoint == NULL)
164+ || tp->control.trap_expected
165+ || tp->stepping_through_solib_after_catch)
166+ return RESUME_STEP_USER;
167+
168+ if (bpstat_should_step ())
169+ return RESUME_STEP_NEEDED;
170+
171+ return RESUME_STEP_CONTINUE;
172 }
173
174 /* Returns true if any thread *but* the one passed in "data" is in the
175Index: gdb-7.3.50.20110722/gdb/linux-nat.c
176===================================================================
177--- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 19:08:19.000000000 +0200
178+++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-22 19:10:24.000000000 +0200
179@@ -2986,7 +2986,10 @@ count_events_callback (struct lwp_info *
180 static int
181 select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
182 {
183- if (lp->step && lp->status != 0)
184+ /* We do not focus on software watchpoints as we would not catch
185+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
186+ as they would remain pending due to `Push back breakpoint for %s'. */
187+ if (lp->step == RESUME_STEP_USER && lp->status != 0)
188 return 1;
189 else
190 return 0;
191Index: gdb-7.3.50.20110722/gdb/linux-nat.h
192===================================================================
193--- gdb-7.3.50.20110722.orig/gdb/linux-nat.h 2011-07-22 19:08:19.000000000 +0200
194+++ gdb-7.3.50.20110722/gdb/linux-nat.h 2011-07-22 19:10:24.000000000 +0200
195@@ -55,8 +55,8 @@ struct lwp_info
196 /* If non-zero, a pending wait status. */
197 int status;
198
199- /* Non-zero if we were stepping this LWP. */
200- int step;
201+ /* The kind of stepping of this LWP. */
202+ enum resume_step step;
203
204 /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
205 be the address of a hardware watchpoint. */