Christophe Weblog Wiki Code Publications Music
store calls and frames on entry to sldb itself
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index c6a1ec2f0e0afe13d7e90a3910370bbb3dfe49ef..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;
@@ -267,3 +269,7 @@ writeSexpToString <- function(obj) {
     invokeRestart(computeRestarts()[[n+1]])
   }
 }
+
+`swank:buffer-first-change` <- function(io, sldbState, filename) {
+  FALSE
+}