4
// Lluis Sanchez Gual <lluis@novell.com>
6
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
// of this software and associated documentation files (the "Software"), to deal
10
// in the Software without restriction, including without limitation the rights
11
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
// copies of the Software, and to permit persons to whom the Software is
13
// furnished to do so, subject to the following conditions:
15
// The above copyright notice and this permission notice shall be included in
16
// all copies or substantial portions of the Software.
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
namespace Mono.Debugging.Client
34
public class BreakEvent
36
[NonSerialized] BreakpointStore store;
37
[NonSerialized] bool enabled = true;
39
HitAction hitAction = HitAction.Break;
40
string customActionId;
41
string traceExpression;
43
string lastTraceValue;
49
internal BreakEvent (XmlElement elem)
51
string s = elem.GetAttribute ("enabled");
53
enabled = bool.Parse (s);
54
s = elem.GetAttribute ("hitAction");
56
hitAction = (HitAction) Enum.Parse (typeof(HitAction), s);
57
s = elem.GetAttribute ("customActionId");
60
s = elem.GetAttribute ("traceExpression");
63
s = elem.GetAttribute ("hitCount");
65
hitCount = int.Parse (s);
68
internal virtual XmlElement ToXml (XmlDocument doc)
70
XmlElement elem = doc.CreateElement (GetType().Name);
72
elem.SetAttribute ("enabled", "false");
73
if (hitAction != HitAction.Break)
74
elem.SetAttribute ("hitAction", hitAction.ToString ());
75
if (!string.IsNullOrEmpty (customActionId))
76
elem.SetAttribute ("customActionId", customActionId);
77
if (!string.IsNullOrEmpty (traceExpression))
78
elem.SetAttribute ("traceExpression", traceExpression);
80
elem.SetAttribute ("hitCount", hitCount.ToString ());
84
internal static BreakEvent FromXml (XmlElement elem)
86
if (elem.Name == "Breakpoint")
87
return new Breakpoint (elem);
88
else if (elem.Name == "Catchpoint")
89
return new Catchpoint (elem);
97
throw new InvalidOperationException ();
102
throw new InvalidOperationException ();
104
store.EnableBreakEvent (this, value);
108
public bool IsValid (DebuggerSession session)
111
throw new InvalidOperationException ();
114
return session.IsBreakEventValid (this);
117
public string TraceExpression {
119
return traceExpression;
122
traceExpression = value;
126
public HitAction HitAction {
135
public string CustomActionId {
137
return customActionId;
140
customActionId = value;
144
internal BreakpointStore Store {
153
public int HitCount {
162
public string LastTraceValue {
164
return lastTraceValue;
167
lastTraceValue = value;
171
public void CommitChanges ()
174
store.NotifyBreakEventChanged (this);
177
internal void NotifyUpdate ()
180
store.NotifyBreakEventUpdated (this);
183
public BreakEvent Clone ()
185
return (BreakEvent) MemberwiseClone ();
188
public virtual void CopyFrom (BreakEvent ev)
190
hitAction = ev.hitAction;
191
customActionId = ev.customActionId;
192
traceExpression = ev.traceExpression;
193
hitCount = ev.hitCount;