forked from praveen96/sootexamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
551 lines (496 loc) · 18.7 KB
/
build.xml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?xml version="1.0" encoding="UTF-8"?>
<project name="Soot Tests" default="compile" basedir=".">
<description>
Build file for examples from "A Survivor's Guide to Java Program Analysis in Soot"
</description>
<!-- set global properties for this build -->
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="soot.output.dir" location="soot_output"/>
<property name="lib.dir" location="lib"/>
<property name="jdk.lib.dir" location="/usr/lib/jvm/java-7-openjdk-amd64/jre/lib"/>
<property name="org.domainexpert.build.dir" location="${build.dir}/main"/>
<!-- properties for the original call graph example -->
<property name="dk.brics.soot.callgraphs.src.dir" location="call_graph/src"/>
<property name="dk.brics.soot.callgraphs.build.dir" location="${build.dir}/call_graph"/>
<!-- properties for the original points-to analysis example -->
<property name="dk.brics.paddle.src.dir" location="pointsto/src"/>
<property name="dk.brics.paddle.build.dir" location="${build.dir}/pointsto"/>
<!-- properties for the original intermediate representation example -->
<property name="dk.brics.soot.intermediate.src.dir" location="intermediate_representation/src"/>
<property name="dk.brics.soot.intermediate.build.dir" location="${build.dir}/intermediate_representation"/>
<!-- properties for the live variable analysis runner -->
<property name="dk.brics.soot.analysis_framework.src.dir" location="analysis_framework/src"/>
<property name="dk.brics.soot.analysis_framework.build.dir" location="${build.dir}/analysis_framework"/>
<!-- Soot library paths -->
<path id="soot.lib">
<pathelement path="${lib.dir}/soot-trunk.jar"/>
</path>
<!-- Java library paths -->
<path id="jre.lib">
<pathelement path="${jdk.lib.dir}/rt.jar"/>
<pathelement path="${jdk.lib.dir}/javazic.jar"/>
<pathelement path="${jdk.lib.dir}/resources.jar"/>
<pathelement path="${jdk.lib.dir}/rhino.jar"/>
<pathelement path="${jdk.lib.dir}/alt-rt.jar"/>
<pathelement path="${jdk.lib.dir}/alt-string.jar"/>
<pathelement path="${jdk.lib.dir}/charsets.jar"/>
<pathelement path="${jdk.lib.dir}/classes.jar"/>
<pathelement path="${jdk.lib.dir}/dt.jar"/>
<pathelement path="${jdk.lib.dir}/jce.jar"/>
<pathelement path="${jdk.lib.dir}/jconsole.jar"/>
<pathelement path="${jdk.lib.dir}/jsse.jar"/>
<pathelement path="${jdk.lib.dir}/management-agent.jar"/>
<pathelement path="${jdk.lib.dir}/ui.jar"/>
</path>
<!-- The value of -soot-class-path -->
<path id="soot.class.path">
<path refid="jre.lib"/>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</path>
<!-- The value of -soot-class-path for the original call graph example -->
<path id="dk.brics.soot.callgraphs.soot.class.path">
<path refid="jre.lib"/>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.soot.callgraphs.build.dir}"/>
</path>
<!-- The value of -soot-class-path for the original points-to analysis example -->
<path id="dk.brics.paddle.soot.class.path">
<path refid="soot.class.path"/>
<pathelement path="${lib.dir}/paddle-0.3.jar"/>
<pathelement path="${lib.dir}/jedd-runtime.jar"/>
<pathelement path="${lib.dir}/jedd-translator.jar"/>
<pathelement path="${dk.brics.paddle.build.dir}"/>
</path>
<!-- The value of -soot-class-path for the original intermediate representation example -->
<path id="dk.brics.soot.intermediate.soot.class.path">
<path refid="jre.lib"/>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.soot.intermediate.build.dir}"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</path>
<!-- The value of -soot-class-path for the live variable analyis -->
<path id="dk.brics.soot.analysis_framework.soot.class.path">
<path refid="jre.lib"/>
<pathelement path="${dk.brics.soot.analysis_framework.build.dir}"/>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<!-- Create the Soot output directory -->
<mkdir dir="${soot.output.dir}"/>
<!-- Create the build directory for own-made programs -->
<mkdir dir="${org.domainexpert.build.dir}"/>
<!-- Create the build directory of the original call graph example -->
<mkdir dir="${dk.brics.soot.callgraphs.build.dir}"/>
<!-- Create the build directory of the points-to example -->
<mkdir dir="${dk.brics.paddle.build.dir}"/>
<!-- Create the build directory of the intermediate representation example -->
<mkdir dir="${dk.brics.soot.intermediate.build.dir}"/>
<!-- Create the build directory of the analysis framework -->
<mkdir dir="${dk.brics.soot.analysis_framework.build.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source">
<!-- Compile the own-made programs -->
<javac srcdir="${src.dir}" destdir="${org.domainexpert.build.dir}" includeantruntime="false"
deprecation="on">
<classpath refid="soot.lib"/>
</javac>
<!-- Compile the original call graph example -->
<javac srcdir="${dk.brics.soot.callgraphs.src.dir}"
destdir="${dk.brics.soot.callgraphs.build.dir}"
includeantruntime="false" deprecation="on">
<classpath refid="soot.lib"/>
</javac>
<!-- Compile the original points-to analysis example -->
<javac srcdir="${dk.brics.paddle.src.dir}"
destdir="${dk.brics.paddle.build.dir}"
includeantruntime="false" deprecation="on">
<classpath refid="dk.brics.paddle.soot.class.path"/>
</javac>
<!-- Compile the original intermediate representation example -->
<javac srcdir="${dk.brics.soot.intermediate.src.dir}"
destdir="${dk.brics.soot.intermediate.build.dir}"
includeantruntime="false" deprecation="on">
<classpath refid="soot.lib"/>
</javac>
<!-- Compile the analysis framework example -->
<javac srcdir="${dk.brics.soot.analysis_framework.src.dir}"
destdir="${dk.brics.soot.analysis_framework.build.dir}"
includeantruntime="false" deprecation="on">
<classpath refid="soot.lib"/>
</javac>
</target>
<target name="clean"
description="clean up">
<!-- Delete the build and Soot output directory trees -->
<delete dir="${build.dir}"/>
<delete dir="${soot.output.dir}"/>
</target>
<!-- This outputs Jimple representation of the bytecode -->
<target name="jimple" depends="compile"
description="output jimple code">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!-- This outputs Shimple representation of the bytecode -->
<target name="shimple" depends="compile"
description="output shimple code">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-f"/>
<arg value="shimple"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!--
This outputs Jimple representation of the bytecode
with optimization using constant propagation and folder.
-->
<target name="jimple-optimized" depends="compile"
description="output jimple code">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-O"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!--
This outputs Jimple representation of the bytecode
with optimization using Shimple constant propagation
and folder.
-->
<target name="jimple-optimized-via-shimple" depends="compile"
description="output jimple code">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-f"/>
<arg value="jimple"/>
<arg value="-via-shimple"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-O"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!-- This outputs Grimple representation of the bytecode -->
<target name="grimple" depends="compile"
description="output jimple code">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-f"/>
<arg value="G"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainaexpert.build.dir}"/>
</java>
</target>
<!-- This performs null pointer analysis -->
<target name="null-pointer-analysis" depends="compile"
description="run null pointer analysis">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-xml-attributes"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
<arg value="-p"/>
<arg value="jap.npcolorer"/>
<arg value="on"/>
<arg value="org.domainexpert.survivor.test.NullPointerTest"/>
</java>
</target>
<!-- This performs array bounds check -->
<target name="array-bounds-check" depends="compile"
description="run array bounds check">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-xml-attributes"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
<arg value="-p"/>
<arg value="jap.abc"/>
<arg value="on"/>
<arg value="-p"/>
<arg value="jap.abc"/>
<arg value="add-color-tags:true"/>
<arg value="org.domainexpert.survivor.test.ArrayBoundsTest"/>
</java>
</target>
<!-- This performs live variable analysis -->
<target name="liveness" depends="compile"
description="run live variable analysis">
<java classname="soot.Main">
<classpath refid="soot.lib"/>
<arg value="-xml-attributes"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
<arg value="-p"/>
<arg value="jap.lvtagger"/>
<arg value="on"/>
<arg value="org.domainexpert.survivor.test.LiveVariablesTest"/>
</java>
</target>
<!-- Runs very busy expressions analysis -->
<target name="very-busy-expressions" depends="compile"
description="run very busy expressions analysis">
<java classname="org.domainexpert.survivor.VeryBusyExpressionsMain">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!-- Runs very busy expressions analysis -->
<target name="very-busy-expressions-tagger" depends="compile"
description="run very busy expressions analysis with tagging">
<java classname="org.domainexpert.survivor.VeryBusyExpressionsTagger">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<arg value="-process-dir"/>
<arg value="${org.domainexpert.build.dir}"/>
</java>
</target>
<!-- Runs the original call graph example -->
<target name="original-callgraph" depends="compile"
description="run the original call graph example">
<java className="dk.brics.soot.callgraphs.CallGraphExample"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.soot.callgraphs.build.dir}"/>
</classpath>
<arg value="-soot-class-path"/>
<arg pathref="dk.brics.soot.callgraphs.soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
<!--
This avoids building the call graph of the excluded
JDK methods, which would slow down the call graph
construction significantly.
-->
<arg value="-no-bodies-for-excluded"/>
</java>
</target>
<!-- Runs the original points-to analysis example -->
<target name="original-pointsto-spark" depends="compile"
description="run the original points-to analysis example">
<java className="dk.brics.paddle.PointsToAnalysis"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.paddle.build.dir}"/>
</classpath>
<arg value="spark"/>
<arg value="org.domainexpert.survivor.test.ContainerUser"/>
<arg pathref="dk.brics.paddle.soot.class.path"/>
<arg value="${soot.output.dir}"/>
</java>
</target>
<!-- Runs the original points-to analysis example -->
<target name="original-pointsto-paddle" depends="compile"
description="run the original points-to analysis example">
<java className="dk.brics.paddle.PointsToAnalysis"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${lib.dir}/paddle-0.3.jar"/>
<pathelement path="${lib.dir}/jedd-runtime.jar"/>
<pathelement path="${lib.dir}/jedd-translator.jar"/>
<pathelement path="${user.home}/src/research/projects/analysis/software/chord-libsrc-2.1/JavaBDD/javabdd-1.0b2.jar"/>
<pathelement path="${dk.brics.paddle.build.dir}"/>
</classpath>
<arg value="paddle"/>
<arg value="org.domainexpert.survivor.test.ContainerUser"/>
<arg pathref="dk.brics.paddle.soot.class.path"/>
<arg value="${soot.output.dir}"/>
</java>
</target>
<!-- Runs the original intermediate representation example -->
<target name="original-intermediate" depends="compile"
description="run the original intermediate representation example">
<java className="dk.brics.soot.intermediate.main.Main"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.soot.intermediate.build.dir}"/>
</classpath>
<arg pathref="dk.brics.soot.intermediate.soot.class.path"/>
<arg value="org.domainexpert.survivor.test.foo.FooUser"/>
</java>
</target>
<!-- Run hello world generator (adapted from Vallee-Rai's thesis) -->
<target name="thesis-helloworld" depends="compile"
description="run the Hello world! synthesis example from Vallee-Rai's thesis">
<java className="org.domainexpert.soot.thesis.helloworld.Main"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<arg value="${soot.output.dir}"/>
</java>
</target>
<!--
Run live variable analysis. The runner is included in
Soot Survivor's Guide, but the analysis itself is part of Soot.
-->
<target name="original-livevariable" depends="compile"
description="run Soot's live variables analysis using JDK class">
<java className="dk.brics.soot.RunLiveAnalysis"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${dk.brics.soot.analysis_framework.build.dir}"/>
</classpath>
<!-- The class to analyze -->
<arg value="testers.LiveVarsClass"/>
<!-- The value for -soot-class-path -->
<arg pathref="dk.brics.soot.analysis_framework.soot.class.path"/>
</java>
</target>
<!-- Run constant propagation example (adapted from Vallee-Rai's thesis) -->
<target name="thesis-constantpropagation" depends="compile"
description="run the constant propagation synthesis example from Vallee-Rai's thesis">
<java className="org.domainexpert.soot.thesis.constantpropagation.Main"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<!--
This example resulted in constant replacements in two statements.
Compare ${soot.output.dir}/org.domainexpert.survivor.test.VeryBusyExpressionTest.jimple
for this target and the jimple target (which would simply produce the
Jimple representation.
-->
<arg value="org.domainexpert.survivor.test.VeryBusyExpressionTest"/>
<arg value="-f"/>
<arg value="J"/>
<arg value="-verbose"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
</java>
</target>
<!-- Run constant propagation example (adapted from Vallee-Rai's thesis) -->
<target name="thesis-instrumentation" depends="compile"
description="run the instrumentation example from Vallee-Rai's thesis">
<echo message="Instrumenting program ..."/>
<java className="org.domainexpert.soot.thesis.instrumentation.Main"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<!--
This is an example with simple loop
-->
<arg value="--app"/>
<arg value="org.domainexpert.survivor.test.SimpleLoop"/>
<arg value="-verbose"/>
<arg value="-f"/>
<arg value="class"/>
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
<arg value="-output-dir"/>
<arg value="${soot.output.dir}"/>
</java>
<echo message="Running instrumented program ..."/>
<java className="org.domainexpert.survivor.test.SimpleLoop">
<classpath>
<pathelement path="${soot.output.dir}"/>
</classpath>
<arg value="3"/>
</java>
</target>
<!-- Run the scene evaluator from Vallee-Rai's thesis (Chapter 5) -->
<target name="thesis-sceneevaluator" depends="compile"
description="run the scene evaluator example from Vallee-Rai's thesis">
<java className="org.domainexpert.soot.thesis.scene.Main"
fork="yes" maxmemory="2G">
<classpath>
<path refid="soot.lib"/>
<pathelement path="${org.domainexpert.build.dir}"/>
</classpath>
<!-- Here we still use the SimpleLoop program -->
<arg value="-app"/>
<arg value="org.domainexpert.survivor.test.SimpleLoop"/>
<!-- This transformation produces no output -->
<arg value="-f"/>
<arg value="none"/>
<!-- The Soot class path -->
<arg value="-soot-class-path"/>
<arg pathref="soot.class.path"/>
</java>
</target>
<target name="soot-options">
<java className="soot.Main">
<classpath>
<path refid="soot.lib"/>
</classpath>
<arg value="-help"/>
</java>
</target>
</project>