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
/
ExceptionCatchPoint.cs
99 lines (79 loc) · 2.19 KB
/
ExceptionCatchPoint.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
using System;
using System.Xml;
using Mono.Debugger.Backend;
using System.Runtime.Serialization;
using Mono.Debugger.Languages;
using Mono.Debugger.Languages.Mono;
using Mono.Debugger.Backend.Mono;
namespace Mono.Debugger
{
[Serializable]
public sealed class ExceptionCatchPoint : Event
{
public override bool IsPersistent {
get { return true; }
}
public override bool NeedsActivation {
get { return false; }
}
public bool Unhandled {
get; set;
}
internal ExceptionCatchPoint (ThreadGroup group, TargetType exception, bool unhandled)
: base (EventType.CatchException, exception.Name, group)
{
this.exception = exception;
this.Unhandled = unhandled;
}
internal ExceptionCatchPoint (int index, ThreadGroup group, string name, bool unhandled)
: base (EventType.CatchException, index, name, group)
{
this.Unhandled = unhandled;
}
public override bool IsActivated {
get { return true; }
}
public override void Activate (Thread target)
{ }
public override void Deactivate (Thread target)
{ }
internal override void OnTargetExited ()
{
exception = null;
}
public override void Remove (Thread target)
{ }
bool IsSubclassOf (TargetMemoryAccess target, TargetClassType type,
TargetType parent)
{
while (type != null) {
if (type == parent)
return true;
if (!type.HasParent)
return false;
type = type.GetParentType (target);
}
return false;
}
internal bool CheckException (MonoLanguageBackend mono, TargetMemoryAccess target,
TargetAddress address)
{
TargetClassObject exc = mono.CreateObject (target, address) as TargetClassObject;
if (exc == null)
return false; // OOOPS
if (exception == null)
exception = mono.LookupType (Name);
if (exception == null)
return false;
return IsSubclassOf (target, exc.Type, exception);
}
protected override void GetSessionData (XmlElement root, XmlElement element)
{
XmlElement exception_e = root.OwnerDocument.CreateElement ("Exception");
exception_e.SetAttribute ("type", Name);
exception_e.SetAttribute ("unhandled", Unhandled ? "true" : "false");
element.AppendChild (exception_e);
}
TargetType exception;
}
}