]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
- obsolete file
[packages/gdb.git] / gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
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
24 Index: gdb-6.8.50.20081209/gdb/inferior.h
25 ===================================================================
26 --- gdb-6.8.50.20081209.orig/gdb/inferior.h     2008-11-20 01:35:23.000000000 +0100
27 +++ gdb-6.8.50.20081209/gdb/inferior.h  2008-12-10 01:22:23.000000000 +0100
28 @@ -168,7 +168,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  /* From misc files */
44  
45 Index: gdb-6.8.50.20081209/gdb/infrun.c
46 ===================================================================
47 --- gdb-6.8.50.20081209.orig/gdb/infrun.c       2008-12-02 20:20:23.000000000 +0100
48 +++ gdb-6.8.50.20081209/gdb/infrun.c    2008-12-10 01:23:46.000000000 +0100
49 @@ -73,7 +73,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_callback (struct thread_info *tp, void *data);
57  
58 @@ -961,7 +961,7 @@ set_schedlock_func (char *args, int from
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);
67 @@ -975,10 +975,12 @@ resume (int step, enum target_signal sig
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
84 @@ -1127,9 +1129,10 @@ a command like `return' or `jump' to con
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;
97 @@ -1302,7 +1305,7 @@ proceed (CORE_ADDR addr, enum target_sig
98    struct gdbarch *gdbarch = get_regcache_arch (regcache);
99    struct thread_info *tp;
100    CORE_ADDR pc = regcache_read_pc (regcache);
101 -  int oneproc = 0;
102 +  enum resume_step resume_step = RESUME_STEP_CONTINUE;
103  
104    if (step > 0)
105      step_start_function = find_pc_function (pc);
106 @@ -1322,13 +1325,13 @@ proceed (CORE_ADDR addr, enum target_sig
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      {
122 @@ -1359,13 +1362,13 @@ proceed (CORE_ADDR addr, enum target_sig
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
138 @@ -1451,8 +1454,13 @@ proceed (CORE_ADDR addr, enum target_sig
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.  */
153 @@ -3690,10 +3698,16 @@ currently_stepping_callback (struct thre
154    return tp != data && currently_stepping_thread (tp);
155  }
156  
157 -static int
158 +static enum resume_step
159  currently_stepping (struct thread_info *tp)
160  {
161 -  return currently_stepping_thread (tp) || bpstat_should_step ();
162 +  if (currently_stepping_thread (tp))
163 +    return RESUME_STEP_USER;
164 +
165 +  if (bpstat_should_step ())
166 +    return RESUME_STEP_NEEDED;
167 +
168 +  return RESUME_STEP_CONTINUE;
169  }
170  
171  /* Inferior has stepped into a subroutine call with source code that
172 Index: gdb-6.8.50.20081209/gdb/linux-nat.c
173 ===================================================================
174 --- gdb-6.8.50.20081209.orig/gdb/linux-nat.c    2008-12-02 08:57:36.000000000 +0100
175 +++ gdb-6.8.50.20081209/gdb/linux-nat.c 2008-12-10 01:22:23.000000000 +0100
176 @@ -2343,7 +2343,10 @@ count_events_callback (struct lwp_info *
177  static int
178  select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
179  {
180 -  if (lp->step && lp->status != 0)
181 +  /* We do not focus on software watchpoints as we would not catch
182 +     STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
183 +     as they would remain pending due to `Push back breakpoint for %s'.  */
184 +  if (lp->step == RESUME_STEP_USER && lp->status != 0)
185      return 1;
186    else
187      return 0;
188 Index: gdb-6.8.50.20081209/gdb/linux-nat.h
189 ===================================================================
190 --- gdb-6.8.50.20081209.orig/gdb/linux-nat.h    2008-07-27 23:12:40.000000000 +0200
191 +++ gdb-6.8.50.20081209/gdb/linux-nat.h 2008-12-10 01:22:23.000000000 +0100
192 @@ -55,8 +55,8 @@ struct lwp_info
193    /* If non-zero, a pending wait status.  */
194    int status;
195  
196 -  /* Non-zero if we were stepping this LWP.  */
197 -  int step;
198 +  /* The kind of stepping of this LWP.  */
199 +  enum resume_step step;
200  
201    /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
202       be the address of a hardware watchpoint.  */
This page took 0.043307 seconds and 3 git commands to generate.