Assigned: March 29, 2005
Due: April 9, 2005
In this assignment you will get a little bit of experience with two of the static analysis tools we have been discussing, ESCJava and SPIN.
Run ESCJava on some Java code that is at least 50 lines of code long. To make this work you must have JDK 1.4+ as your working version of Java. On our department Linux machines, this is NOT the default. You must do
source /local/config/cshrc.java1.4.1To get Java 1.4.1 as your working version.
Once you do that, then you can ESCJava on some of your code. The command is
/home/trutta2/srg/tools/ESCJava-2.0a5/escjava2 yourfile.javaESCJava must be able to find libraries in your CLASSPATH. ESCJava should work on both Linux and Sun machines, but I've only tried it on Linux.
Save the output of ESCJava in a text file. For at least two issues that ESCJava reports, you must examine the source code, decide if it needs fixed, and include some written discussion of those two issues in your submission (you can write the discussion into the output file -- just make sure it is marked as such).
Hint: the "script" command is good at capturing output. Redirection might work but sometimes it separates output (if both stdout and stderr are producing output). I haven't tried simple redirection, so it might work just fine.
For this part, grab this dining philosophers Promela file, save it locally and run spin on it.
Spin is installed at
/home/trutta2/srg/tools/spin4.1.2/Src4.1.2/spinThis binary is compiled for a Linux PC. It's a pretty small package, and if you want to build it for Sun, go right ahead, it's easy enough.
For each of the runs of Spin below, save the output so that you can submit it.
What do you get when you simulate it? Does it stop? What is the condition that causes it to stop?
Now verify it. What is the error that is reported? What does this mean in terms of the application? (In other words, what are the philosophers doing that causes this error?)
Fix the error. Hint: You only need to rearrange some constructs to fix it. You do not need to add any new Promela capability or understand anything about Promela that is not already in this file.
But if you really want to enjoy some light reading, try looking in file:///home/trutta2/srg/tools/spin4.1.2/Doc/HTML/
Verify it again. Is it fixed?
Submit your output and discussion for the first part, and your output, your answers to the questions, and your fixed Promela code for the second part. Submit this through the web submission system, by midnight on April 9, 2005.