The FPT run-time trace facility is a technology of last resort
for debugging code migrations, and for tracing errors in large arithmetic codes.
FPT instruments selected components of the code to capture all left-hand-side
scalar quantities to file. The command is
% INSERT RUN-TIME TRACE
For example, this code models a cannon ball with square-law drag.
This is modified by FPT to capture the outputs of every statement. Click here for the modified code.
The routine TRACE_START_SUB_PROGRAM logs the start of a program,
subroutine or function. The routines TRACE_R4_DATA , TRACE_I4_DATA etc. write the left-hand-side data to
file. These routines are self-initialising - the log file is created on the
first pass if it does not already exist.
The output shows entries to sub-programs, and the left-hand-side quantities,
written one to each line. Click here to see the trace output.
The main loop, starting with the copy of HDDOT to P_HDDOT and ending with the computation of the new
value of X can clearly be seen.
If a program reads or generates bad data, it is usually possible to trace
back to the cause of the problem. The output files can become very large, so we
recommend that only a small sub-set of the files in a large program should be
instrumented in this way.
|