The R Project SVN R

Rev

Rev 61150 | Rev 70207 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61150 Rev 61433
Line 10... Line 10...
10
\description{
10
\description{
11
  By default \code{traceback()} prints the call stack of the last
11
  By default \code{traceback()} prints the call stack of the last
12
  uncaught error, i.e., the sequence of calls that lead to the error.
12
  uncaught error, i.e., the sequence of calls that lead to the error.
13
  This is useful when an error occurs with an unidentifiable error
13
  This is useful when an error occurs with an unidentifiable error
14
  message.  It can also be used to print the current stack or
14
  message.  It can also be used to print the current stack or
15
  arbitrary lists of deparsed calls.  
15
  arbitrary lists of deparsed calls.
16
}
16
}
17
\usage{
17
\usage{
18
traceback(x = NULL, max.lines = getOption("deparse.max.lines"))
18
traceback(x = NULL, max.lines = getOption("deparse.max.lines"))
19
}
19
}
20
\arguments{
20
\arguments{
21
  \item{x}{\code{NULL} (default, meaning \code{.Traceback}), or an
21
  \item{x}{\code{NULL} (default, meaning \code{.Traceback}), or an
22
    integer count of calls to skip in the current stack, or a list or
22
    integer count of calls to skip in the current stack, or a list or
23
    pairlist of deparsed calls.  See the details.}    
23
    pairlist of deparsed calls.  See the details.}
24
  \item{max.lines}{The maximum number of lines to be printed
24
  \item{max.lines}{The maximum number of lines to be printed
25
    \emph{per call}.  The default is unlimited.}
25
    \emph{per call}.  The default is unlimited.}
26
}
26
}
27
\details{
27
\details{
28
  The default display is of the stack of the last uncaught error as
28
  The default display is of the stack of the last uncaught error as
Line 30... Line 30...
30
  \code{traceback} prints in a user-friendly format.  The stack of
30
  \code{traceback} prints in a user-friendly format.  The stack of
31
  deparsed calls always contains all function calls and all foreign
31
  deparsed calls always contains all function calls and all foreign
32
  function calls (such as \code{\link{.Call}}): if profiling is in
32
  function calls (such as \code{\link{.Call}}): if profiling is in
33
  progress it will include calls to some primitive functions.  (Calls
33
  progress it will include calls to some primitive functions.  (Calls
34
  to builtins are included, but not to specials.)
34
  to builtins are included, but not to specials.)
35
  
35
 
36
  Errors which are caught \emph{via} \code{\link{try}} or
36
  Errors which are caught \emph{via} \code{\link{try}} or
37
  \code{\link{tryCatch}} do not generate a traceback, so what is printed
37
  \code{\link{tryCatch}} do not generate a traceback, so what is printed
38
  is the call sequence for the last uncaught error, and not necessarily
38
  is the call sequence for the last uncaught error, and not necessarily
39
  for the last error.
39
  for the last error.
40
  
40
 
41
  If \code{x} is numeric, then the current stack is printed, skipping
41
  If \code{x} is numeric, then the current stack is printed, skipping
42
  \code{x} entries at the top of the stack.  For example,
42
  \code{x} entries at the top of the stack.  For example,
43
  \code{options(error = function() traceback(2))} will print the stack
43
  \code{options(error = function() traceback(2))} will print the stack
44
  at the time of the error, skipping the call to \code{traceback()}
44
  at the time of the error, skipping the call to \code{traceback()}
45
  and the error function that called it.
45
  and the error function that called it.
46
  
46
 
47
  Otherwise, \code{x} is assumed to be a list or pairlist of deparsed
47
  Otherwise, \code{x} is assumed to be a list or pairlist of deparsed
48
  calls and will be displayed in the same way.
48
  calls and will be displayed in the same way.
49
}
49
}
50
\value{
50
\value{
51
  \code{traceback()} prints the deparsed call stack deepest call
51
  \code{traceback()} prints the deparsed call stack deepest call