From: Christophe Rhodes Date: Sat, 14 Aug 2010 20:12:20 +0000 (+0100) Subject: store calls and frames on entry to sldb itself X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=commitdiff_plain;h=f0e964468a16d45bd23117bcb720f2d733018791;hp=746cf1b465d24639b7486ebe33f20f5d2a4dbcc5 store calls and frames on entry to sldb itself Rather than do complicated stuff to keep track of where we are in the stack, simply store the interesting frames and calls in the sldb state structure. --- diff --git a/swank.R b/swank.R index 09ad173..b5fd98c 100644 --- a/swank.R +++ b/swank.R @@ -54,7 +54,9 @@ emacsRex <- function(io, sldbState, form, pkg, thread, id, level=0) { } makeSldbState <- function(condition, level, id) { - ret <- list(condition=condition, level=level, id=id) + calls <- rev(sys.calls())[-1] + frames <- rev(sys.frames())[-1] + ret <- list(condition=condition, level=level, id=id, calls=calls, frames=frames) class(ret) <- c("sldbState", class(ret)) ret } @@ -69,7 +71,7 @@ sldbLoop <- function(io, sldbState, id) { debuggerInfoForEmacs <- function(sldbState, from=0, to=NULL) { backtraceForEmacs <- function() { - calls <- rev(sys.calls()) + calls <- sldbState$calls if(is.null(to)) to <- length(calls) from <- from+1 calls <- lapply(calls[from:to], { frameNumber <- from-1;