Axiom contains some powerful commands to help with testing and
debugging library modules written in Spad and also the Axiom system
itself. The most important of these commands is )trace.
This command is used to trace the execution of functions that make up the Axiom system, functions defined by users, and functions from the system library. Almost all options are available for each type of function but exceptions will be noted below.
To list all functions, constructors, domains and packages that are traced, simply issue:
)trace
To untrace everything that is traced, issue:
)trace )off
When a function is traced, the default system action is to display
the arguments to the function and the return value when the function
is exited. Other information can be displayed or collected when a
function is traced and this is controlled by the various options.
If a domain or package is traced, the default action is to trace all
functions exported. Individual interpreter, lisp or boot functions
can be traced by listing their names after )trace. Any options that
are present must follow the functions to be traced. For example:
)trace f
traces the function f. To untrace f, issue:
)trace f )off
Note that if a function name contains a special character, it will be necessary to escape the character with an underscore:
)trace _/D_,1
To trace all domains or packages that are or will be created from a particular constructor, give the constructor name or abbreviation after ')trace':
)trace MATRIX )trace List Integer
The first command traces all domains currently instantiated with
Matrix. If additional domains are instantiated with this constructor
(for example, if you have used Matrix(Integer) and Matrix(Float)),
they will be automatically traced. The second command traces
List(Integer).
The following are the general options for the )trace command.
)break after)break before)break)countThe total can be displayed with:
)trace )stats
and cleared with:
)trace )stats reset
)count n)depth nThe command:
)trace fib )depth 10
will cause the display of only 10 levels of trace information for the recursive execution of a user function fib.
)math causes)nonquietly)nt)count or )timer options are used and you are interested in the
statistics but not the function calling information.)offTo immediately retrace the untraced functions, issue:
)trace )restore
)only listOfDataToDisplay)restore)stats)count and )timer options.)stats reset)count and )timer options.)timer)trace )stats and
cleared with )trace )stats reset.)varbreak var1 ... varN)vars)vartrace option in order to support this option.)vars var1 ... varN)vartrace
option in order to support this option.)within executingFunctionThe following are the options for tracing constructors, domains and packages.
)local op1 ... opN)trace FRAC )local )trace FRAC_;cancelGcd )off
)ops op1 ... opNThe command:
)trace Integer )ops min max _+ _-
traces four operations from the domain Integer. Since + and - are special characters, it is necessary to escape them with an underscore.
Also See: )boot, )lisp , and )ltrace. Please refer to the
Axiom Book, section "Axiom System Commands"
for more detailed information.