## Not run: ------------------------------------
# options(error = quote(dump.frames("testdump", TRUE)))
#
# f <- function() {
# g <- function() stop("test dump.frames")
# g()
# }
# f() # will generate a dump on file "testdump.rda"
# options(error = NULL)
#
# ## possibly in another R session
# load("testdump.rda")
# debugger(testdump)
# Available environments had calls:
# 1: f()
# 2: g()
# 3: stop("test dump.frames")
#
# Enter an environment number, or 0 to exit
# Selection: 1
# Browsing in the environment with call:
# f()
# Called from: debugger.look(ind)
# Browse[1]> ls()
# [1] "g"
# Browse[1]> g
# function() stop("test dump.frames")
# <environment: 759818>
# Browse[1]>
# Available environments had calls:
# 1: f()
# 2: g()
# 3: stop("test dump.frames")
#
# Enter an environment number, or 0 to exit
# Selection: 0
#
# ## A possible setting for non-interactive sessions
# options(error = quote({dump.frames(to.file = TRUE); q(status = 1)}))
## ---------------------------------------------
Run the code above in your browser using DataLab