Skip to content

Commit 693f48b

Browse files
author
smeyer
committed
do run a dump.frames example
git-svn-id: https://svn.r-project.org/R/trunk@88457 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 8e8c821 commit 693f48b

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/library/utils/man/debugger.Rd

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

9897
f <- 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()
108110
Available environments had calls:
109111
1: f()
110112
2: g()
@@ -113,7 +115,7 @@ Available environments had calls:
113115
Enter an environment number, or 0 to exit
114116
Selection: 1
115117
Browsing in the environment with call:
116-
f()
118+
f()
117119
Called from: debugger.look(ind)
118120
Browse[1]> ls()
119121
[1] "g"
@@ -128,9 +130,15 @@ Available environments had calls:
128130

129131
Enter an environment number, or 0 to exit
130132
Selection: 0
133+
}
131134

135+
\dontrun{
132136
## A possible setting for non-interactive sessions
133137
options(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

Comments
 (0)