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.

  1. Run it through the cfe analyzer:
    cfe calc.c

    you 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, and calc.cil

  2. Run it through the branch trace instrumenter:
    il-bt-2 calc.c

    This 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

  3. 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

  4. Run the instrumented executable by typing:
    calc.int.exe

    and run the test 1 on it.

    do ls $ARISTOTLE_DB_DIR/calc* and you should see a new file in the database: calc.c.tr

    This contains the trace of calc.

  5. View this trace by typing:
    tr_printer $ARISTOTLE_DB_DIR/calc.c.tr calc.c

    which prints out info on the trace (for each function in calc, for each branch in that function, whether it was executed on that test.)

  6. 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
  7. 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
  8. Build a test history file by typing:
    th_builder tracedir tracedir/th calc.c

    This puts its output in file "th" in "tracedir"; it collects all the .tr files in that directory to do so.

  9. View this test history by typing:
    th_printer tracedir/th calc.c