aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGemini Lasswell2018-07-17 11:47:43 -0700
committerGemini Lasswell2018-08-03 08:54:08 -0700
commitca98377280005344fb07c816997b9bc2a737056a (patch)
tree11172830e890866a63a154dad9e68850b8cf5064 /test
parent1459ad2c670e7633f426d7a5a7f05fab23195b32 (diff)
downloademacs-ca98377280005344fb07c816997b9bc2a737056a.tar.gz
emacs-ca98377280005344fb07c816997b9bc2a737056a.zip
Add new commands to Edebug backtraces
Add commands to go to source if available, and to show and hide Edebug's instrumentation. Make Edebug pop to backtraces instead of displaying them, which makes Edebug consistant with the behavior of ERT and the Lisp Debugger. * doc/lispref/edebug.texi (Edebug Misc): Document when and how you can jump to source code from an Edebug backtrace. Document 'edebug-backtrace-show-instrumentation' and 'edebug-backtrace-hide-instrumentation'. * lisp/emacs-lisp/backtrace.el (backtrace-frame): Add comments to describe the fields. (backtrace-goto-source-functions): New abnormal hook. (backtrace-mode-map): Add keybinding and menu item for backtrace-goto-source. (backtrace--flags-width): New constant. (backtrace-update-flags): Use it. (backtrace-goto-source): New command. (backtrace--print-flags): Print the :source-available flag. * lisp/emacs-lisp/edebug.el (edebug-backtrace-frames) (edebug-instrumented-backtrace-frames): New variables. (edebug-backtrace, edebug--backtrace-frames): Remove functions. (edebug-pop-to-backtrace, edebug--backtrace-goto-source) (edebug--add-source-info): New functions. (edebug-mode-map, edebug-mode-menus): Replace 'edebug-backtrace' with 'edebug-pop-to-backtrace'. (edebug--strip-instrumentation): New function. (edebug--unwrap-and-add-info): Remove. (edebug-unwrap-frame, edebug-add-source-info): New functions. (edebug-backtrace-show-instrumentation) (edebug-backtrace-hide-instrumentation): New commands. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-check-keymap): Verify keybindings in backtrace-mode-map used by new test. Update with binding for 'edebug-pop-to-backtrace'. (edebug-tests-backtrace-goto-source): New test. * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el (edebug-test-code-range): Add a new stop point.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el2
-rw-r--r--test/lisp/emacs-lisp/edebug-tests.el18
2 files changed, 17 insertions, 3 deletions
diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
index f3fc78d4e12..97dead057a9 100644
--- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
+++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
@@ -41,7 +41,7 @@
41(defun edebug-test-code-range (num) 41(defun edebug-test-code-range (num)
42 !start!(let ((index 0) 42 !start!(let ((index 0)
43 (result nil)) 43 (result nil))
44 (while (< index num)!test! 44 (while !lt!(< index num)!test!
45 (push index result)!loop! 45 (push index result)!loop!
46 (cl-incf index))!end-loop! 46 (cl-incf index))!end-loop!
47 (nreverse result))) 47 (nreverse result)))
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el
index 7d780edf285..7880aaf95bc 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -432,9 +432,11 @@ test and possibly others should be updated."
432 (verify-keybinding "P" 'edebug-view-outside) ;; same as v 432 (verify-keybinding "P" 'edebug-view-outside) ;; same as v
433 (verify-keybinding "W" 'edebug-toggle-save-windows) 433 (verify-keybinding "W" 'edebug-toggle-save-windows)
434 (verify-keybinding "?" 'edebug-help) 434 (verify-keybinding "?" 'edebug-help)
435 (verify-keybinding "d" 'edebug-backtrace) 435 (verify-keybinding "d" 'edebug-pop-to-backtrace)
436 (verify-keybinding "-" 'negative-argument) 436 (verify-keybinding "-" 'negative-argument)
437 (verify-keybinding "=" 'edebug-temp-display-freq-count))) 437 (verify-keybinding "=" 'edebug-temp-display-freq-count)
438 (should (eq (lookup-key backtrace-mode-map "n") 'backtrace-forward-frame))
439 (should (eq (lookup-key backtrace-mode-map "s") 'backtrace-goto-source))))
438 440
439(ert-deftest edebug-tests-stop-point-at-start-of-first-instrumented-function () 441(ert-deftest edebug-tests-stop-point-at-start-of-first-instrumented-function ()
440 "Edebug stops at the beginning of an instrumented function." 442 "Edebug stops at the beginning of an instrumented function."
@@ -924,5 +926,17 @@ test and possibly others should be updated."
924 "g" 926 "g"
925 (should (equal edebug-tests-@-result "The result of applying + to (1 x) is 11"))))) 927 (should (equal edebug-tests-@-result "The result of applying + to (1 x) is 11")))))
926 928
929(ert-deftest edebug-tests-backtrace-goto-source ()
930 "Edebug can jump to instrumented source from its *Edebug-Backtrace* buffer."
931 (edebug-tests-with-normal-env
932 (edebug-tests-setup-@ "range" '(2) t)
933 (edebug-tests-run-kbd-macro
934 "@ SPC SPC"
935 (edebug-tests-should-be-at "range" "lt")
936 "dns" ; Pop to backtrace, next frame, goto source.
937 (edebug-tests-should-be-at "range" "start")
938 "g"
939 (should (equal edebug-tests-@-result '(0 1))))))
940
927(provide 'edebug-tests) 941(provide 'edebug-tests)
928;;; edebug-tests.el ends here 942;;; edebug-tests.el ends here