-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.txt
56 lines (52 loc) · 3.74 KB
/
README.txt
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
README - MP1 Responses
*** All source code can be found in the SRC folder ***
*** Project files were compiled using IntelliJ but source code Java files should run in any system ***
----------------------------------------------------------------------------------------------
Part 1: Control Flow Analysis
I concluded that the given implementation for doAnalysis() was correct. I came to this conclusion by
locating the corresponding dominator analysis in the Soot source code (in the provided GitHub link).
I compared the two algorithms line-by-line and found them to be identicical in implementation.
----------------------------------------------------------------------------------------------
Part 2: Data Flow Analysis
CHA Output:
<src.Example: src.Animal selectAnimal()> may call <src.Cat: void <init>()>
<src.Example: void main(java.lang.String[])> may call <src.Example: src.Animal selectAnimal()>
<src.Example: void main(java.lang.String[])> may call <src.Cat: void saySomething()>
<src.Example: void main(java.lang.String[])> may call <src.Fish: void saySomething()>
<src.Animal: void <init>()> may call <java.lang.Object: void <init>()>
<src.Cat: void <init>()> may call <src.Animal: void <init>()>
<src.Cat: void saySomething()> may call <java.lang.System: void <clinit>()>
<src.Cat: void saySomething()> may call <java.io.PrintStream: void println(java.lang.String)>
<src.Cat: void saySomething()> may call <java.lang.Object: void <clinit>()>
<src.Fish: void saySomething()> may call <java.lang.System: void <clinit>()>
<src.Fish: void saySomething()> may call <java.io.PrintStream: void println(java.lang.String)>
<src.Fish: void saySomething()> may call <java.lang.Object: void <clinit>()>
Total Edges:12
PTA Output:
<src.Example: src.Animal selectAnimal()> may call <src.Cat: void <init>()>
<src.Example: void main(java.lang.String[])> may call <src.Example: src.Animal selectAnimal()>
<src.Example: void main(java.lang.String[])> may call <src.Cat: void saySomething()>
<src.Animal: void <init>()> may call <java.lang.Object: void <init>()>
<src.Cat: void <init>()> may call <src.Animal: void <init>()>
<src.Cat: void saySomething()> may call <java.lang.System: void <clinit>()>
<src.Cat: void saySomething()> may call <java.lang.Object: void <clinit>()>
Total Edges:7
Analysis:
The results showed that CHA found 12 total edges while PTA found 7 edges. This discrepency comes
from the fact that CHA is less precise; it gets all the subtypes of the object type, in this case
Animal, and any type that has a matching function definition is identified. These bring up false positives.
Dog, Fish, and Cat all have saySomething() methods, and each is returned as a counted edge.
Some type of innacuracy is inevitable since the problem of pointer analysis is undecidable and cannot
be perfectly solved. The given example program that is being tested is very small, so the difference
in speed is less apparent. However, in larger cases, while less precise, the CHA approach will run faster
due to its near linear time complexity.
-------------------------------------------------------------------------------------------------
Part 3: Tracing Heap Accesses
TestSootLoggingHeap.java Output:
Thread Thread-14 wrote static field <src.HelloThread: int x>
Thread Thread-13 read instance field <src.HelloThread$TestThread: int y> of object Thread[Thread-13,5,Soot Threadgroup]
Thread Thread-14 read instance field <src.HelloThread$TestThread: int y> of object Thread[Thread-14,5,Soot Threadgroup]
Thread Thread-13 read static field <src.HelloThread: int x>
Thread Thread-14 wrote instance field <src.HelloThread$TestThread: int y> of object Thread[Thread-14,5,Soot Threadgroup]
Thread Thread-13 read static field <java.lang.System: java.io.PrintStream out>
Thread Thread-13 wrote static field <src.HelloThread: int x>