Difference between revisions of "JavaMOP and RVMonitor Usage"
(→Compile AspectJ File) |
|||
(5 intermediate revisions by one user not shown) | |||
Line 12: | Line 12: | ||
http://eclipse.org/aspectj/ | http://eclipse.org/aspectj/ | ||
− | + | or git clone a modified AspectJ which is able to weave DaCapo 9.12 with 179 specifications: | |
git clone -b javamop ssh://[your-id]@fslwork.cs.illinois.edu/home/clee83/repository/aspectj | git clone -b javamop ssh://[your-id]@fslwork.cs.illinois.edu/home/clee83/repository/aspectj | ||
Line 35: | Line 35: | ||
You can run the script: | You can run the script: | ||
− | source $rv-monitor/bin/rvmonitor [options] <path-to- | + | source $rv-monitor/bin/rvmonitor [options] <path-to-rvm> |
Frequently used options are | Frequently used options are | ||
Line 41: | Line 41: | ||
-d $MONITOR_DIR -silent -n all -merge | -d $MONITOR_DIR -silent -n all -merge | ||
− | = JavaMop = | + | = JavaMop 4.0 = |
+ | |||
+ | === Installation === | ||
+ | You can clone it from the github: | ||
+ | |||
+ | https://github.com/runtimeverification/javamop | ||
+ | |||
+ | Use "ant" to build it. | ||
+ | |||
+ | === Usage === | ||
+ | You can run the script: | ||
+ | |||
+ | .$javamop/bin/javamop [options] <path-to-mop> | ||
+ | |||
+ | Frequently used options are | ||
+ | |||
+ | -d $RVSPEC_DIR -silent -n all -merge | ||
+ | |||
+ | $RVSPEC_DIR is the output file directory. After executing the command, a .aj file will be generated in $RVSPEC_DIR (the library code generated by rvmonitor is appended to the original .aj file). Note that rvmonitor.jar and rt.jar has already been included in the $javamop/lib. JavaMop will invoke rvmonitor automatically during the generation of .aj file. Thus, rvmonitor is "invisible" to the users. | ||
+ | |||
+ | = Weave and Run = | ||
+ | === Compile AspectJ File === | ||
+ | Use ajc to weave the code: | ||
+ | |||
+ | ajc -1.6 -cp $javamop/lib/rt.jar:$path-to-aspectjrt.jar -d $OUTPUT-DIR <path-to-aj-file> <path-to-java-file> | ||
+ | |||
+ | After compiliation, a .class file will be generated in $OUTPUT-DIR | ||
+ | |||
+ | === Run the Weaved Code === | ||
+ | Suppose Foo is the name of the weaved .class file. Then, run the following command: | ||
+ | |||
+ | java -cp $javamop/lib/rt.jar:$path-to-aspectjrt.jar Foo | ||
+ | |||
+ | You will run the programs with monitors. | ||
+ | You can also create java agent to weave the code at runtime. For more information, please go to: | ||
+ | http://fsl.cs.illinois.edu/index.php/JavaMOPAgent |
Latest revision as of 19:26, 8 May 2014
Contents |
[edit] Prerequisite
[edit] Scala
You can obtain scala(2.9.1 is preferred) from:
http://www.scala-lang.org/
Don't forget to set SCALA_HOME environment to the path where you install the scala.
[edit] AspectJ
You can either download AspectJ from the website:
http://eclipse.org/aspectj/
or git clone a modified AspectJ which is able to weave DaCapo 9.12 with 179 specifications:
git clone -b javamop ssh://[your-id]@fslwork.cs.illinois.edu/home/clee83/repository/aspectj
For detailed information, please refer to:
http://fsl.cs.illinois.edu/index.php/JavaMOPAgent
[edit] RV Monitor
[edit] Installation
You can clone it from the github:
https://github.com/runtimeverification/rv-monitor
Use "ant" to build it. After compilation, you will see several .jar files generated under $rv-monitor/lib. Among them:
- rvmonitor.jar: rvmonitor which is used to generate library code with .rvm file.
- rt.jar: runtime library used by generated library code. This jar file contains all the important data structures like AbstactMonitor, AbstractMonitorSet, Indexing Tree and so on.
[edit] Usage
You can run the script:
source $rv-monitor/bin/rvmonitor [options] <path-to-rvm>
Frequently used options are
-d $MONITOR_DIR -silent -n all -merge
[edit] JavaMop 4.0
[edit] Installation
You can clone it from the github:
https://github.com/runtimeverification/javamop
Use "ant" to build it.
[edit] Usage
You can run the script:
.$javamop/bin/javamop [options] <path-to-mop>
Frequently used options are
-d $RVSPEC_DIR -silent -n all -merge
$RVSPEC_DIR is the output file directory. After executing the command, a .aj file will be generated in $RVSPEC_DIR (the library code generated by rvmonitor is appended to the original .aj file). Note that rvmonitor.jar and rt.jar has already been included in the $javamop/lib. JavaMop will invoke rvmonitor automatically during the generation of .aj file. Thus, rvmonitor is "invisible" to the users.
[edit] Weave and Run
[edit] Compile AspectJ File
Use ajc to weave the code:
ajc -1.6 -cp $javamop/lib/rt.jar:$path-to-aspectjrt.jar -d $OUTPUT-DIR <path-to-aj-file> <path-to-java-file>
After compiliation, a .class file will be generated in $OUTPUT-DIR
[edit] Run the Weaved Code
Suppose Foo is the name of the weaved .class file. Then, run the following command:
java -cp $javamop/lib/rt.jar:$path-to-aspectjrt.jar Foo
You will run the programs with monitors. You can also create java agent to weave the code at runtime. For more information, please go to:
http://fsl.cs.illinois.edu/index.php/JavaMOPAgent