This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
/
JDIScala.scala
61 lines (52 loc) · 1.61 KB
/
JDIScala.scala
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
package rwars2012.agent
import com.sun.jdi.{Location, ReferenceType, ThreadReference}
import com.sun.jdi.event.{
Event,
ClassPrepareEvent,
MethodEntryEvent,
StepEvent,
ThreadDeathEvent, ThreadStartEvent,
VMDeathEvent, VMStartEvent, VMDisconnectEvent
}
object Step {
def unapply(in: Event): Option[(ThreadReference, Location)] = in match {
case (step: StepEvent) => Some((step.thread, step.location))
case _ => None
}
}
object ClassPrepare {
def unapply(in: Event): Option[ReferenceType] = in match {
case (classPrepare: ClassPrepareEvent) => Some(classPrepare.referenceType)
case _ => None
}
}
object MethodEntry {
def unapply(in: Event): Option[(ThreadReference, com.sun.jdi.Method)] = in match {
case (methodEntry: MethodEntryEvent) => Some(methodEntry.thread, methodEntry.method)
case _ => None
}
}
object ThreadDeath {
def unapply(in: Event): Option[ThreadReference] = in match {
case (threadDeath: ThreadDeathEvent) => Some(threadDeath.thread)
case _ => None
}
}
object ThreadStart {
def unapply(in: Event): Option[ThreadReference] = in match {
case (threadStart: ThreadStartEvent) => Some(threadStart.thread)
case _ => None
}
}
object VMDeath {
def unapply(in: Event): Boolean = in.isInstanceOf[VMDeathEvent]
}
object VMStart {
def unapply(in: Event): Option[ThreadReference] = in match {
case (vmStart: VMStartEvent) => Some(vmStart.thread)
case _ => None
}
}
object VMDisconnect {
def unapply(in: Event): Boolean = in.isInstanceOf[VMDisconnectEvent]
}