]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
store calls and frames on entry to sldb itself
authorChristophe Rhodes <csr21@cantab.net>
Sat, 14 Aug 2010 20:12:20 +0000 (21:12 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Sat, 14 Aug 2010 20:12:20 +0000 (21:12 +0100)
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.

swank.R

diff --git a/swank.R b/swank.R
index 09ad173d3285d2e139fac4ec220e16f766c67af4..b5fd98c202e1bb8751ddd03c01b273c681d8f9f8 100644 (file)
--- 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;