SWAG >> SWAG Kit >> Usage Instructions | |
Using SWAG KitUsing Swagkit is not very difficult, although it is assumed that the user is familiar with compiler technology. Before trying SWAG Kit on a large system, we suggest you try the two examples found below.The pipeline currently consists of 5 major steps:
Small exampleApplying SWAG Kit to this small example is an ideal test of whether the Kit is installed correctly. At the same time, this example illustrates all the major steps you have to take to perform fact extraction.
A bigger exampleIn this example, we'll apply SWAG Kit to a slightly larger example: a toy compiler used in a computer science course at the University of Toronto.
A real exampleExtracting the architecture of the vi editor is a perfect way to start using the CPPX pipeline on real systems. vi is small enough to be manageable (91 files, 257Kloc) but is nevertheless a real, complex system, with its own configuration scripts and makefiles. For systems of more than trivial size it is impractical to apply cppx by hand (as we did in our small example) or write custom scripts to do the processing (as we did in the bigger example). Large systems typically come with makefiles that we can use to help us perform the extraction. In order to use existing makefiles to perform fact extraction for us we need to modify them so that they would invoke cppx and prep in addition to compiling and linking the program itself. The CPPX pipeline is shipped with the gce utility, which is meant to replace gcc in makefiles of large applications. When invoked, gce does the following things:
In systems that use many makefiles, or that are specifically dependent on the value of the $CC variable, the substitution task may be considerably more difficult, and additional modifications of the makefile may be required. In cases of extreme difficulty, it may be tempting to revert to hand-invocation of cppx, as shown in the small example above. In practice, however, it is almost always better to modify the makefile to suit your needs, as hand-application of cppx to large systems is always very labour-intensive. In the case of vi, the extraction is relatively simple. Here is a step-by-step guide to extracting the architecture of vi:
The steps outlined above will not work for all complicated projects. The vi example illustrates
the general approach of makefile modification for fact extraction with the CPPX pipeline.
|