Added DiSL project
This commit is contained in:
parent
431eb23b4e
commit
031b07d70e
39 changed files with 172 additions and 0 deletions
5
DiSLProject2022/.gitignore
vendored
Normal file
5
DiSLProject2022/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
bin-profiler
|
||||||
|
build/profiler.jar
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
|
57
DiSLProject2022/README.md
Normal file
57
DiSLProject2022/README.md
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
This bundle contains the template of the various exercises that compose the DiSL project.
|
||||||
|
Please refer to the text of the DiSL project for more information on the the purpose of each exercise.
|
||||||
|
|
||||||
|
## Bundle structure
|
||||||
|
Each exercise is composed of two parts: 1) profiler and 2) observed application.
|
||||||
|
- Profiler code is located in the `src-profiler` folder. In each exercise, there is always a single DiSL class (i.e., the class containing DiSL snippets) which is called `Instrumentation`. You can add as many profiler classes as you like to the `src-profiler` folder. However, all DiSL snippets *must* be added to the existing `Instrumentation` class.
|
||||||
|
- Observed applications compiled are located as `jar` archive in the `build` folder. In each exercise, the main class of the observed application is always called `Main`. The source code of the observed application is not provided.
|
||||||
|
- Both the profiler and the observed applications are contained in a package called `ex<i>` (where <i> is a progressive integer number). For example, both the profiler and the observed applications that refer to the first exercise are contained in package `ex1`.
|
||||||
|
|
||||||
|
## How to build
|
||||||
|
Building requires the `ant` program.
|
||||||
|
You have to compile and build the sources each time you want to use a different profiler.
|
||||||
|
|
||||||
|
To run the build process, execute
|
||||||
|
`ant -Ddislclass=<DiSL class>`
|
||||||
|
in the root of the folder, where *<DiSL class>* is the fully qualified name of the DiSL class corresponding to the profiler you want to run.
|
||||||
|
|
||||||
|
For example, if you want to use the profiler that refers to the first exercise, run:
|
||||||
|
`ant -Ddislclass=ex1.Instrumentation`.
|
||||||
|
|
||||||
|
The build process will generate the JARs `build/profiler.jar`, containing the profiler.
|
||||||
|
|
||||||
|
|
||||||
|
## How to run the observed application (uninstrumented)
|
||||||
|
The observed application (without any profiler) can be normally run via:
|
||||||
|
`bash ./run.sh <main class>`
|
||||||
|
where *<main class>* is the fully qualified name of the main class you want to run.
|
||||||
|
|
||||||
|
For example, to run the main class of the first exercise, run:
|
||||||
|
`bash ./run.sh ex1.Main`
|
||||||
|
|
||||||
|
|
||||||
|
## How to run the observed application (instrumented)
|
||||||
|
To run the observed application instrumented with a profiler:
|
||||||
|
|
||||||
|
- *First*, start the DiSL Server by executing `bash ./startDiSLServer.sh`.
|
||||||
|
- *Then*, start the observed application (with the profiler attached) by executing `bash ./runInstrumented.sh <main class>`
|
||||||
|
where *<main class>* is the fully qualified name of the main class you want to run.
|
||||||
|
|
||||||
|
**Note**: the profiler that will be applied to the observed application is *always* the one corresponding to the DiSL class specified at build time!
|
||||||
|
|
||||||
|
|
||||||
|
## Cleanup
|
||||||
|
You can run `ant clean` to discard generated profiler JAR.
|
||||||
|
Please do not erease the following file/folder:
|
||||||
|
- folder: `build`
|
||||||
|
- file: `build/app.jar`
|
||||||
|
otherwise you need to download them again from iCorsi.
|
||||||
|
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
To run e.g. the instrumented observed application of the first exercise, execute, in order:
|
||||||
|
|
||||||
|
- `ant clean`
|
||||||
|
- `ant -Ddislclass=ex1.Instrumentation`
|
||||||
|
- `bash ./startDiSLServer.sh`
|
||||||
|
- `bash ./runInstrumented.sh ex1.Main`
|
30
DiSLProject2022/build.xml
Normal file
30
DiSLProject2022/build.xml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<project name="AJPDislProject" default="build" basedir=".">
|
||||||
|
|
||||||
|
<path id="profiler.classpath">
|
||||||
|
<fileset dir="lib" includes="*.jar" />
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<target name="compile-profiler">
|
||||||
|
<mkdir dir="bin-profiler" />
|
||||||
|
<javac includeantruntime="false" destdir="bin-profiler" srcdir="src-profiler" debug="false" classpathref="profiler.classpath" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build-profiler" depends="compile-profiler">
|
||||||
|
<mkdir dir="build"/>
|
||||||
|
<jar destfile="build/profiler.jar" basedir="bin-profiler">
|
||||||
|
<manifest>
|
||||||
|
<attribute name="DiSL-Classes" value="${dislclass}" />
|
||||||
|
</manifest>
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="build" depends="build-profiler" />
|
||||||
|
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="bin-profiler" />
|
||||||
|
<delete file="build/profiler.jar" />
|
||||||
|
<delete dir="dump" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
BIN
DiSLProject2022/build/app.jar
Normal file
BIN
DiSLProject2022/build/app.jar
Normal file
Binary file not shown.
1
DiSLProject2022/exclusion.lst
Normal file
1
DiSLProject2022/exclusion.lst
Normal file
|
@ -0,0 +1 @@
|
||||||
|
jdk.internal.module.*.*
|
BIN
DiSLProject2022/lib/args4j.jar
Normal file
BIN
DiSLProject2022/lib/args4j.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/asm-analysis.jar
Normal file
BIN
DiSLProject2022/lib/asm-analysis.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/asm-commons.jar
Normal file
BIN
DiSLProject2022/lib/asm-commons.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/asm-tree.jar
Normal file
BIN
DiSLProject2022/lib/asm-tree.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/asm-util.jar
Normal file
BIN
DiSLProject2022/lib/asm-util.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/asm.jar
Normal file
BIN
DiSLProject2022/lib/asm.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/classgraph.jar
Normal file
BIN
DiSLProject2022/lib/classgraph.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/disl-bypass.jar
Normal file
BIN
DiSLProject2022/lib/disl-bypass.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/disl-controller.jar
Normal file
BIN
DiSLProject2022/lib/disl-controller.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/disl-preprocessor.jar
Normal file
BIN
DiSLProject2022/lib/disl-preprocessor.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/disl-server.jar
Normal file
BIN
DiSLProject2022/lib/disl-server.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/dislre-dispatch.jar
Normal file
BIN
DiSLProject2022/lib/dislre-dispatch.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/dislre-server.jar
Normal file
BIN
DiSLProject2022/lib/dislre-server.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/libdislagent.jnilib
Normal file
BIN
DiSLProject2022/lib/libdislagent.jnilib
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/libdislagent.so
Normal file
BIN
DiSLProject2022/lib/libdislagent.so
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/libdislreagent.jnilib
Normal file
BIN
DiSLProject2022/lib/libdislreagent.jnilib
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/libdislreagent.so
Normal file
BIN
DiSLProject2022/lib/libdislreagent.so
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/narcissus.jar
Normal file
BIN
DiSLProject2022/lib/narcissus.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/protobuf-javalite.jar
Normal file
BIN
DiSLProject2022/lib/protobuf-javalite.jar
Normal file
Binary file not shown.
BIN
DiSLProject2022/lib/protobuf-lite.jar
Normal file
BIN
DiSLProject2022/lib/protobuf-lite.jar
Normal file
Binary file not shown.
8
DiSLProject2022/run.sh
Executable file
8
DiSLProject2022/run.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <Name of main class>"
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
$JAVA_HOME/bin/java -cp build/app.jar $*
|
24
DiSLProject2022/runInstrumented.sh
Executable file
24
DiSLProject2022/runInstrumented.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <Name of main class>"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
AGENT_EXT=.so
|
||||||
|
|
||||||
|
#Checks if OS is MacOS
|
||||||
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
AGENT_EXT=.jnilib
|
||||||
|
fi
|
||||||
|
|
||||||
|
AGENT_FLAGS=
|
||||||
|
|
||||||
|
JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
|
||||||
|
|
||||||
|
if [ "$JAVA_VERSION" -gt "8" ]; then
|
||||||
|
AGENT_FLAGS="$AGENT_FLAGS --patch-module java.base=lib/disl-bypass.jar --add-exports java.base/ch.usi.dag.disl.dynamicbypass=ALL-UNNAMED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$JAVA_HOME"/bin/java -agentpath:lib/libdislagent$AGENT_EXT $AGENT_FLAGS -Xbootclasspath/a:lib/disl-bypass.jar:build/profiler.jar -cp build/app.jar -noverify $*
|
4
DiSLProject2022/src-profiler/ex1/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex1/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex1;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex10/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex10/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex10;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex11/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex11/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex11;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex2/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex2/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex2;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex3/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex3/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex3;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex4/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex4/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex4;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex5/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex5/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex5;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex6/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex6/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex6;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex7/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex7/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex7;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex8/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex8/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex8;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
4
DiSLProject2022/src-profiler/ex9/Instrumentation.java
Normal file
4
DiSLProject2022/src-profiler/ex9/Instrumentation.java
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
package ex9;
|
||||||
|
|
||||||
|
public class Instrumentation {
|
||||||
|
}
|
3
DiSLProject2022/startDiSLServer.sh
Executable file
3
DiSLProject2022/startDiSLServer.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
$JAVA_HOME/bin/java -Ddisl.exclusionList="exclusion.lst" -cp build/profiler.jar:lib/disl-server.jar ch.usi.dag.dislserver.DiSLServer &
|
Reference in a new issue