Using Aristotle Tools
Get a copy of calc.c from the "samples" subdirectory in the Aristotle area. Make sure you can run it -- it's a postfix calculater; if you compile it with gcc and run the exe you should be able to type things like:
2 4 +
=
and see output
6.000000
or
3 5 * =
and see output
15.0000
and type
q
to quit
(Consider these to be tests 1 and 2 of calc)
From the menus, you can run aristotle tools. But they also run from the command line; that's what we'll do.
First, go through the following steps with calc.c to see how this is done.
- Run it through the cfe analyzer:
cfe calc.cyou should see a warning, but otherwise it should complete, and now if you look in your database by typing:
ls $ARISTOTLE_DB_DIR/calc*you should see files
calc.c, calc.c.cf, calc.c.du, calc.c.map calc.c.sym,andcalc.cil - Run it through the branch trace instrumenter:
il-bt-2 calc.cThis should complete with no messages, and if you look in your current directory you should see file calc.int.c, an instrumented version of calc.c
- Compile and link this with:
gcc -g -I/nfs/spectre/u5/aristot/v3/headers/ -o calc.int.exe calc.int.c-L/nfs/spectre/u5/aristot/v3/lib/sunos5/ -lIPF_bt -lglobalfunc -lm(this should be typed in as a single line with no carriage returns)
Now your directory should contain calc.int.exe
- Run the instrumented executable by typing:
calc.int.exeand run the test 1 on it.
do
ls $ARISTOTLE_DB_DIR/calc*and you should see a new file in the database: calc.c.trThis contains the trace of calc.
- View this trace by typing:
tr_printer $ARISTOTLE_DB_DIR/calc.c.tr calc.cwhich prints out info on the trace (for each function in calc, for each branch in that function, whether it was executed on that test.)
- Make a directory to hold traces; I'll call it "tracedir".
Copy the above trace there calling it "0.tr":
cp $ARISTOTLE_DB_DIR/calc.c.tr tracedir/0.tr - Run the instrumented executable again, run test 2 on it. This will
again put a trace in the database directory, overwriting the previous
one. Move it to your trace directory:
cp $ARISTOTLE_DB_DIR/calc.c.tr tracedir/1.tr - Build a test history file by typing:
th_builder tracedir tracedir/th calc.cThis puts its output in file "th" in "tracedir"; it collects all the .tr files in that directory to do so.
- View this test history by typing:
th_printer tracedir/th calc.c