Lab 2: Bytecode Analysis of a Java ApplicationThe goal of this lab is to subject your application from the previous lab to a static bytecode analysis using the CDA (Class Dependency Analysis) tool. You will need to install and use the CDA tool, which is available for download from the course website.
CDA is a tool that parses Java bytecode and outputs (either textually as an XML/ODEM file or graphically via the the tool's GUI) the class dependencies found in the bytecode. Use the CDA tool's GUI to become familiar with the capabilities of the tool. CDA can analyze the java bytecode of your application and export the results to an XML/ODEM file. To do this, run CDA on your application's bytecode (i.e., .class) files. After the tool loads the files and creates the dependencies, select the top-most folder (e.g., /User/spiros/code), middle-click (or Apple-click for Mac users) on the folder and select the Export Model -> XML/ODEM file pop-up menu option. This will save the class dependencies in an XML/ODEM file.
You are asked to write a script that parses the XML/ODEM output file and converts it to an MDG file that can be used as input to other tools that will be used in the next lab. The MDG format is simple, each line in the file has two words separated by a space. E.g., assume the MDG file is as follows:
This means that class A uses class B, class B uses class C, and class A uses class C, and so on.
Apart from creating a script that can generate the MDG for the entire application, you are asked to implement the following reachability scripts (i.e., programs that can be executed on the command line).
In addition to producing the MDG output your scripts should also have an option to produce dot files that can be visualized using Graphviz. Graphviz is a graph visualization program that is available for download from the course website. The Graphviz distribution has examples of dot files.