View | Details | Raw Unified | Return to bug 17116
Collapse All | Expand All

(-)src/library/utils/R/debugger.R (-3 / +11 lines)
Lines 16-26 Link Here
16
#  A copy of the GNU General Public License is available at
16
#  A copy of the GNU General Public License is available at
17
#  https://www.R-project.org/Licenses/
17
#  https://www.R-project.org/Licenses/
18
18
19
dump.frames <- function(dumpto = "last.dump", to.file = FALSE)
19
dump.frames <- function(dumpto = "last.dump", to.file = FALSE,
20
                        include.GlobalEnv = FALSE)
20
{
21
{
21
    calls <- sys.calls()
22
    calls <- sys.calls()
22
    last.dump <- sys.frames()
23
    if (include.GlobalEnv) {
23
    names(last.dump) <- limitedLabels(calls)
24
      # include a copy of (and not just a reference to) .GlobalEnv in the dump
25
      last.dump <- c(as.environment(as.list(.GlobalEnv, all.names = TRUE)),
26
                     sys.frames())
27
      names(last.dump) <- c(".GlobalEnv", limitedLabels(calls))
28
    } else {
29
      last.dump <- sys.frames()
30
      names(last.dump) <- limitedLabels(calls)
31
    }
24
    last.dump <- last.dump[-length(last.dump)] # remove this function
32
    last.dump <- last.dump[-length(last.dump)] # remove this function
25
    attr(last.dump, "error.message") <- geterrmessage()
33
    attr(last.dump, "error.message") <- geterrmessage()
26
    class(last.dump) <- "dump.frames"
34
    class(last.dump) <- "dump.frames"

Return to bug 17116