11% File src / library / utils / man / debugger.Rd
22% Part of the R package , https : // www.R - project.org
3- % Copyright 1995 - 2023 R Core Team
3+ % Copyright 1995 - 2025 R Core Team
44% Distributed under GPL 2 or later
55
66\name {debugger }
@@ -40,7 +40,7 @@ limitedLabels(value, maxwidth = getOption("width") - 5L)
4040 to \code {dump.frames }. By default this dumps to an \R object
4141 \code {last.dump } in the workspace , but it can be set to dump to a
4242 file (a dump of the object produced by a call to \code {\link {save }}).
43- The dumped object contain the call stack , the active environments and
43+ The dumped object contains the call stack , the active environments and
4444 the last error message as returned by \code {\link {geterrmessage }}.
4545
4646 When dumping to file , \code {dumpto } gives the name of the dumped
@@ -92,19 +92,21 @@ limitedLabels(value, maxwidth = getOption("width") - 5L)
9292 \code {debugger } but directly after the error occurs.
9393}
9494\examples {
95- \dontrun {
96- options(error = quote(dump.frames(" testdump" , TRUE )))
95+ op <- options(error = dump.frames )
9796
9897f <- function () {
9998 g <- function () stop(" test dump.frames" )
10099 g()
101100}
102- f() # will generate a dump on file "testdump.rda"
103- options(error = NULL )
101+ f() # will generate a dump in object "last.dump"
102+ str(last.dump )
103+
104+ options(op ) # reset (error = NULL)
105+
106+ \dontrun {
107+ # ## Example of debugger() interaction with 'last.dump'
104108
105- # # possibly in another R session
106- load(" testdump.rda" )
107- debugger(testdump )
109+ > debugger()
108110Available environments had calls :
1091111 : f()
1101122 : g()
@@ -113,7 +115,7 @@ Available environments had calls:
113115Enter an environment number , or 0 to exit
114116Selection : 1
115117Browsing in the environment with call :
116- f()
118+ f()
117119Called from : debugger.look(ind )
118120Browse [1 ]> ls()
119121[1 ] " g"
@@ -128,9 +130,15 @@ Available environments had calls:
128130
129131Enter an environment number , or 0 to exit
130132Selection : 0
133+ }
131134
135+ \dontrun {
132136# # A possible setting for non-interactive sessions
133137options(error = quote({dump.frames(to.file = TRUE ); q(status = 1 )}))
138+ f() # will generate a dump on file "last.dump.rda" and exit
139+ # # then, in another R session
140+ load(" last.dump.rda" )
141+ debugger()
134142}}
135143\keyword {utilities }
136144\keyword {error }
0 commit comments