Christophe Weblog Wiki Code Publications Music
implement swank:frame-source-location
authorChristophe Rhodes <csr21@cantab.net>
Wed, 25 Aug 2010 17:14:38 +0000 (18:14 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 25 Aug 2010 17:14:38 +0000 (18:14 +0100)
Now v in the debugger mostly works.

swank.R

diff --git a/swank.R b/swank.R
index 0684ab0..f395217 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -284,6 +284,21 @@ computeRestartsForEmacs <- function (sldbState) {
   }
 }
 
+`swank:frame-source-location` <- function(io, sldbState, n) {
+  call <- sldbState$calls[[n+1]]
+  srcref <- attr(call, "srcref")
+  srcfile <- attr(srcref, "srcfile")
+  if(is.null(srcfile)) {
+    list(quote(`:error`), "no srcfile")
+  } else {
+    filename <- get("filename", srcfile)
+    list(quote(`:location`),
+         list(quote(`:file`), filename),
+         list(quote(`:line`), srcref[[1]], srcref[[2]]-1),
+         FALSE)
+  }
+}
+
 `swank:buffer-first-change` <- function(io, sldbState, filename) {
   FALSE
 }