~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/Mono.Debugging/Mono.Debugging.Client/BreakEvent.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                int hitCount;
43
43
                string lastTraceValue;
44
44
                
45
 
                public BreakEvent()
 
45
                public BreakEvent ()
46
46
                {
47
47
                }
48
48
                
50
50
                {
51
51
                        string s = elem.GetAttribute ("enabled");
52
52
                        if (s.Length > 0)
53
 
                                enabled = bool.Parse (s);
 
53
                                bool.TryParse (s, out enabled);
54
54
                        s = elem.GetAttribute ("hitAction");
55
55
                        if (s.Length > 0)
56
 
                                hitAction = (HitAction) Enum.Parse (typeof(HitAction), s);
 
56
                                Enum.TryParse<HitAction> (s, out hitAction);
57
57
                        s = elem.GetAttribute ("customActionId");
58
58
                        if (s.Length > 0)
59
59
                                customActionId = s;
60
60
                        s = elem.GetAttribute ("traceExpression");
61
61
                        if (s.Length > 0)
62
62
                                traceExpression = s;
 
63
                        s = elem.GetAttribute ("hitCountMode");
 
64
                        HitCountMode mode;
 
65
                        if (s.Length > 0 && Enum.TryParse<HitCountMode> (s, out mode))
 
66
                                HitCountMode = mode;
63
67
                        s = elem.GetAttribute ("hitCount");
64
68
                        if (s.Length > 0)
65
 
                                hitCount = int.Parse (s);
 
69
                                int.TryParse (s, out hitCount);
 
70
 
 
71
                        // this is to facilitate backward compatibility
 
72
                        if (hitCount > 0 && HitCountMode == HitCountMode.None)
 
73
                                HitCountMode = HitCountMode.GreaterThan;
66
74
                }
67
75
                
68
76
                internal virtual XmlElement ToXml (XmlDocument doc)
76
84
                                elem.SetAttribute ("customActionId", customActionId);
77
85
                        if (!string.IsNullOrEmpty (traceExpression))
78
86
                                elem.SetAttribute ("traceExpression", traceExpression);
 
87
                        if (HitCountMode != HitCountMode.None)
 
88
                                elem.SetAttribute ("hitCountMode", HitCountMode.ToString ());
79
89
                        if (hitCount > 0)
80
90
                                elem.SetAttribute ("hitCount", hitCount.ToString ());
81
91
                        return elem;
85
95
                {
86
96
                        if (elem.Name == "FunctionBreakpoint")
87
97
                                return new FunctionBreakpoint (elem);
88
 
                        else if (elem.Name == "Breakpoint")
 
98
                        if (elem.Name == "Breakpoint")
89
99
                                return new Breakpoint (elem);
90
 
                        else if (elem.Name == "Catchpoint")
 
100
                        if (elem.Name == "Catchpoint")
91
101
                                return new Catchpoint (elem);
92
 
                        else
93
 
                                return null;
 
102
 
 
103
                        return null;
94
104
                }
95
105
                
96
106
                /// <summary>
166
176
                }
167
177
 
168
178
                /// <summary>
 
179
                /// Gets the last value traced.
 
180
                /// </summary>
 
181
                /// <remarks>
 
182
                /// This property returns the last evaluation of TraceExpression.
 
183
                /// </remarks>
 
184
                public string LastTraceValue {
 
185
                        get {
 
186
                                return lastTraceValue;
 
187
                        }
 
188
                        internal set {
 
189
                                lastTraceValue = value;
 
190
                        }
 
191
                }
 
192
 
 
193
                /// <summary>
169
194
                /// Gets or sets the action to be performed when the breakpoint is hit
170
195
                /// </summary>
171
196
                /// <remarks>
186
211
                                hitAction = value;
187
212
                        }
188
213
                }
 
214
 
 
215
                /// <summary>
 
216
                /// Gets or sets the hit count mode.
 
217
                /// </summary>
 
218
                /// <remarks>
 
219
                /// When the break event is hit, the HitCountMode is used to compare the CurrentHitCount
 
220
                /// with the TargetHitCount to determine if the break event should trigger.
 
221
                /// </remarks>
 
222
                public HitCountMode HitCountMode {
 
223
                        get; set;
 
224
                }
 
225
 
 
226
                /// <summary>
 
227
                /// Gets or sets the target hit count.
 
228
                /// </summary>
 
229
                /// <remarks>
 
230
                /// When the break event is hit, if the value of HitCountMode is not None, then
 
231
                /// the value of CurrentHitCount will be incremented. Execution will immediately
 
232
                /// resume if it is determined that the CurrentHitCount vs TargetHitCount
 
233
                /// comparison does not meet the requirements of HitCountMode.
 
234
                /// 
 
235
                /// The CommitChanges() method has to be called for changes in this property
 
236
                /// to take effect.
 
237
                /// </remarks>
 
238
                /// 
 
239
                /// FIXME: rename this to TargetHitCount
 
240
                public int HitCount {
 
241
                        get {
 
242
                                return hitCount;
 
243
                        }
 
244
                        set {
 
245
                                hitCount = value;
 
246
                        }
 
247
                }
 
248
 
 
249
                /// <summary>
 
250
                /// Gets or sets the current hit count.
 
251
                /// </summary>
 
252
                /// <remarks>
 
253
                /// When the break event is hit, the HitCountMode is used to compare the CurrentHitCount
 
254
                /// with the TargetHitCount to determine if the break event should trigger.
 
255
                /// </remarks>
 
256
                public int CurrentHitCount {
 
257
                        get; set;
 
258
                }
189
259
                
190
260
                /// <summary>
191
261
                /// Gets or sets the custom action identifier.
217
287
                }
218
288
                
219
289
                /// <summary>
220
 
                /// Gets or sets the hit count.
221
 
                /// </summary>
222
 
                /// <remarks>
223
 
                /// When the break event is hit, if the value of this propery is greater than 0 then
224
 
                /// the value will be decremented and execution will be immediately resumed.
225
 
                /// The CommitChanges() method has to be called for changes in this
226
 
                /// property to take effect.
227
 
                /// </remarks>
228
 
                public int HitCount {
229
 
                        get {
230
 
                                return hitCount;
231
 
                        }
232
 
                        set {
233
 
                                hitCount = value;
234
 
                        }
235
 
                }
236
 
                
237
 
                /// <summary>
238
 
                /// Gets the last value traced.
239
 
                /// </summary>
240
 
                /// <remarks>
241
 
                /// This property returns the last evaluation of TraceExpression.
242
 
                /// </remarks>
243
 
                public string LastTraceValue {
244
 
                        get {
245
 
                                return lastTraceValue;
246
 
                        }
247
 
                        internal set {
248
 
                                lastTraceValue = value;
249
 
                        }
250
 
                }
251
 
                
252
 
                /// <summary>
253
290
                /// Commits changes done in the break event properties
254
291
                /// </summary>
255
292
                /// <remarks>
266
303
                        if (store != null)
267
304
                                store.NotifyBreakEventUpdated (this);
268
305
                }
 
306
 
 
307
                public virtual bool Reset ()
 
308
                {
 
309
                        bool changed = CurrentHitCount != 0;
 
310
 
 
311
                        CurrentHitCount = 0;
 
312
 
 
313
                        return changed;
 
314
                }
269
315
                
270
316
                /// <summary>
271
317
                /// Clone this instance.