This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Breakpoint.cs
112 lines (96 loc) · 2.56 KB
/
Breakpoint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using Mono.Debugger.Backends;
using System.Runtime.Serialization;
namespace Mono.Debugger
{
// <summary>
// This is an abstract base class which is implemented by the user interface to
// hold the user's settings for a breakpoint.
// </summary>
[Serializable]
public abstract class Breakpoint : ICloneable
{
// <summary>
// An automatically generated unique index for this breakpoint.
// </summary>
public int Index {
get { return index; }
}
// <summary>
// The breakpoint's name. This property has no meaning at all for the
// backend, it's just something which can be displayed to the user to
// help him indentify this breakpoint.
// </summary>
public string Name {
get { return name; }
}
// <summary>
// The ThreadGroup in which this breakpoint "breaks".
// If null, then it breaks in all threads.
// </summary>
public ThreadGroup ThreadGroup {
get { return group; }
}
public bool Breaks (int id)
{
if ((group == null) || group.IsGlobal)
return true;
foreach (int thread in group.Threads) {
if (thread == id)
return true;
}
return false;
}
// <summary>
// Internal breakpoint handler.
// </summary>
// <remarks>
// The return value specifies whether we already dealt with the breakpoint; so you
// normally make it return `true' when overriding.
// </remarks>
internal virtual bool BreakpointHandler (Inferior inferior, out bool remain_stopped)
{
remain_stopped = false;
return false;
}
// <summary>
// This method is called each time the breakpoint is hit.
// It returns true if the target should remain stopped and false
// if the breakpoint is to be ignored.
// </summary>
// <remarks>
// The @target argument is *not* serializable and may not be used
// anywhere outside this handler.
// </remarks>
public virtual bool CheckBreakpointHit (Thread target, TargetAddress address)
{
return true;
}
public abstract Breakpoint Clone ();
object ICloneable.Clone ()
{
return Clone ();
}
public override string ToString ()
{
return String.Format ("{0} ({1}:{2})", GetType (), Index, Name);
}
//
// Everything below is protected.
//
protected int index;
protected string name;
protected ThreadGroup group;
protected static int NextBreakpointIndex = 0;
internal static int GetNextBreakpointIndex ()
{
return ++NextBreakpointIndex;
}
protected Breakpoint (string name, ThreadGroup group)
{
this.index = ++NextBreakpointIndex;
this.group = group;
this.name = name;
}
}
}