tracelast - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Debugging : tracelast

tracelast

show the Maple call stack as of the most recent error

 Calling Sequence tracelast;

Description

 • The tracelast command will display the Maple call stack from the time of the last error that occurred (whether it was trapped by the try-catch construct or not). This is the same display that would have been generated if printlevel had been set to 3 or higher at the time the error occurred, and the error had not been trapped.
 • The tracelast command will only work at the top level.  It cannot be executed from within a procedure.
 • The information provided by tracelast is transient. It can become unavailable at any time that Maple does a garbage collection. Therefore, it is best to use tracelast immediately after an error occurs.
 • The trace information displayed begins with a trace of the surrounding procedure activations (beginning with the top level if 50 or less procedures were active). This is followed by the error message that caused the trace back, and the local variables of the procedure in which the error occurred.
 • Each procedure activation is displayed as two lines. The first line shows the arguments with which the procedure was invoked.
 The second line begins with #, the procedure name and statement number (see showstat), and the statement being executed in that procedure.
 If the tracelast command was terminated by a colon instead of a semicolon, the procedure arguments are elided and "..." is displayed instead. This is useful if the arguments are large Arrays, Matrices, Vectors, Records, or modules.
 • The procedure name and statement number is displayed in a form that is suitable as arguments for the showstat and stopat debugging facilities.

Examples

 > f := proc() g(args) end proc:
 > g := proc() if h(args) then args end if end proc:
 > h := proc() dsolve(args) end proc:
 > $f\left(\frac{ⅆ}{ⅆx}y\left(x\right)+y\left(x\right)+x=0,y\right)$
 > $\mathrm{tracelast}$
 f called with arguments: diff(y(x), x)+y(x)+x = 0, y  #(f,1): g(args)  g called with arguments: diff(y(x), x)+y(x)+x = 0, y  #(g,1): if h(args) then ... end if  h called with arguments: diff(y(x), x)+y(x)+x = 0, y  #(h,1): dsolve(args)  dsolve called with arguments: diff(y(x), x)+y(x)+x = 0, atomizenames = true, build = false, type = none, y  #(dsolve,67): error
 locals defined as: n_ODEs = 1, ARGS = [y], METHOD = METHOD, args2 = (diff(y(x), x)+y(x)+x = 0, y), zz = [], n = n, funcs = funcs, funcs_in_args = funcs_in_args, ans = ans, type_of_conversion = type_of_conversion, use_physics = false, j = j, vars = vars
 > $\mathrm{showstat}\left(h,1\right)$
 h := proc()    1   dsolve(args) end proc
 > $\mathrm{stopat}\left(g,1\right)$
 $\left[{g}\right]$ (1)
 > $\mathrm{showstat}\left(g\right)$
 g := proc()    1*  if h(args) then    2     args        end if end proc
 > 

 See Also