aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-20 14:27:38 +0200
committerLars Ingebrigtsen2019-10-20 14:27:38 +0200
commit34963d632dbf6dc7752962de8aa7dba8af3b8a85 (patch)
tree09a72962590895047d7dd90ae57f81ec9f187ecb
parent34744278ba44d78d2a3718135ac20f2dada303e4 (diff)
downloademacs-34963d632dbf6dc7752962de8aa7dba8af3b8a85.tar.gz
emacs-34963d632dbf6dc7752962de8aa7dba8af3b8a85.zip
Fix edebug--restore-breakpoints re-instrumentinging bug-out
* lisp/emacs-lisp/edebug.el (edebug--restore-breakpoints): Don't bug out when instrumenting/de-instrumenting/re-instrumenting.
-rw-r--r--lisp/emacs-lisp/edebug.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index a3ab23c1a1e..2eceb823716 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1415,23 +1415,24 @@ contains a circular object."
1415 ))) 1415 )))
1416 1416
1417(defun edebug--restore-breakpoints (name) 1417(defun edebug--restore-breakpoints (name)
1418 (let* ((data (get name 'edebug)) 1418 (let ((data (get name 'edebug)))
1419 (offsets (nth 2 data)) 1419 (when (listp data)
1420 (breakpoints (nth 1 data)) 1420 (let ((offsets (nth 2 data))
1421 (start (nth 0 data)) 1421 (breakpoints (nth 1 data))
1422 index) 1422 (start (nth 0 data))
1423 ;; Breakpoints refer to offsets from the start of the function. 1423 index)
1424 ;; The start position is a marker, so it'll move around in a 1424 ;; Breakpoints refer to offsets from the start of the function.
1425 ;; similar fashion as the breakpoint markers. If we find a 1425 ;; The start position is a marker, so it'll move around in a
1426 ;; breakpoint marker that refers to an offset (which is a place 1426 ;; similar fashion as the breakpoint markers. If we find a
1427 ;; where breakpoints can be made), then we restore it. 1427 ;; breakpoint marker that refers to an offset (which is a place
1428 (cl-loop for breakpoint in breakpoints 1428 ;; where breakpoints can be made), then we restore it.
1429 for marker = (nth 3 breakpoint) 1429 (cl-loop for breakpoint in breakpoints
1430 when (and (marker-position marker) 1430 for marker = (nth 3 breakpoint)
1431 (setq index (seq-position 1431 when (and (marker-position marker)
1432 offsets 1432 (setq index (seq-position
1433 (- (marker-position marker) start)))) 1433 offsets
1434 collect (cons index (cdr breakpoint))))) 1434 (- (marker-position marker) start))))
1435 collect (cons index (cdr breakpoint)))))))
1435 1436
1436(defun edebug-new-definition (def-name) 1437(defun edebug-new-definition (def-name)
1437 "Set up DEF-NAME to use Edebug's instrumentation functions." 1438 "Set up DEF-NAME to use Edebug's instrumentation functions."