Rev 9617 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{debug}\title{Debug a function}\usage{debug(fun)undebug(fun)}\alias{debug}\alias{undebug}\arguments{\item{fun}{any interpreted \R function.}}\description{Set or unset the debugging flag on a function.}\details{When a function flagged for debugging is entered, normal executionis suspended and the body of function is executed one statement at a time.A new browser context is initiated for each step (and the previous onedestroyed).Currently you can only debug functions that have bodies enclosed in braces.This is a bug and will be fixed soon.% -when was this "soon" written? [MM. 1998.9.4]You take the next step by typing carriage return, \code{n} or \code{next}.You can see the values of variables by typing their names.Typing \code{c} or \code{cont} causes the debugger to continue to theend of the function.You can \code{debug} new functions before you step in to them from insidethe debugger.Typing \code{Q} quits the current execution and returns you to thetop--level prompt.Typing \code{where} causes the debugger to print out the currentstack trace (all functions that are active).If you have variables with names that are identical to the controls(eg. \code{c} or \code{n} ) then you need to use \code{print(c)} and\code{print(n)} to evaluate them.}\seealso{\code{\link{browser}}, \code{\link{traceback}} to see the stack afteran \code{Error: \dots} message.}\keyword{programming}\keyword{environment}