mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Single stepping through code from Emacs
When you use GDS to evaluate Scheme code from Emacs, you can now use `C-u' to indicate that you want to single step through that code. See `Evaluating Scheme Code' in the manual for more details. * scheme-using.texi (Evaluating Scheme Code): Document use of `C-u' prefix with evaluation commands. * gds-scheme.el (gds-eval-region, gds-eval-expression) (gds-eval-defun, gds-eval-last-sexp): Support `C-u' prefix, meaning that user wants to single step through the code. * gds-client.scm (handle-nondebug-protocol): Add support for setting a trap on code that is about to be evaluated.
This commit is contained in:
parent
0d751d4720
commit
091baf9edf
7 changed files with 68 additions and 19 deletions
6
NEWS
6
NEWS
|
@ -43,6 +43,12 @@ Changes in 1.8.6 (since 1.8.5)
|
|||
|
||||
** New convenience function `scm_c_symbol_length ()'
|
||||
|
||||
** Single stepping through code from Emacs
|
||||
|
||||
When you use GDS to evaluate Scheme code from Emacs, you can now use
|
||||
`C-u' to indicate that you want to single step through that code. See
|
||||
`Evaluating Scheme Code' in the manual for more details.
|
||||
|
||||
* Bugs fixed
|
||||
|
||||
** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-07-17 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* scheme-using.texi (Evaluating Scheme Code): Document use of
|
||||
`C-u' prefix with evaluation commands.
|
||||
|
||||
2008-07-05 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* api-data.texi (Symbol Primitives): Add `scm_c_symbol_length ()'.
|
||||
|
|
|
@ -988,6 +988,14 @@ region contains a balanced expression, or try to expand the region so
|
|||
that it does; it uses the region exactly as it is.
|
||||
@end table
|
||||
|
||||
If you type @kbd{C-u} before one of these commands, GDS will
|
||||
immediately pop up a Scheme stack buffer, showing the requested
|
||||
evaluation, so that you can single step through it. (This is achieved
|
||||
by setting a @code{<source-trap>} trap at the start of the requested
|
||||
evaluation; see @ref{Source Traps} for more on how those work.) The
|
||||
Scheme stack display, and the options for continuing through the code,
|
||||
are described in the next two sections.
|
||||
|
||||
|
||||
@node Displaying the Scheme Stack
|
||||
@subsection Displaying the Scheme Stack
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2008-07-17 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* gds-scheme.el (gds-eval-region, gds-eval-expression)
|
||||
(gds-eval-defun, gds-eval-last-sexp): Support `C-u' prefix,
|
||||
meaning that user wants to single step through the code.
|
||||
|
||||
2007-02-06 Clinton Ebadi <clinton@unknownlamer.org>
|
||||
|
||||
* gds-scheme.el (gds-display-results): Use save-selected-window
|
||||
|
|
|
@ -279,9 +279,12 @@ region's code."
|
|||
(setq line (count-lines (point-min) (point))))
|
||||
(cons line column)))
|
||||
|
||||
(defun gds-eval-region (start end)
|
||||
"Evaluate the current region."
|
||||
(interactive "r")
|
||||
(defun gds-eval-region (start end &optional debugp)
|
||||
"Evaluate the current region. If invoked with `C-u' prefix (or, in
|
||||
a program, with optional DEBUGP arg non-nil), pause and pop up the
|
||||
stack at the start of the evaluation, so that the user can single-step
|
||||
through the code."
|
||||
(interactive "r\nP")
|
||||
(or gds-client
|
||||
(gds-auto-associate-buffer)
|
||||
(call-interactively 'gds-associate-buffer))
|
||||
|
@ -289,24 +292,29 @@ region's code."
|
|||
(port-name (gds-port-name start end))
|
||||
(lc (gds-line-and-column start)))
|
||||
(let ((code (buffer-substring-no-properties start end)))
|
||||
(gds-send (format "eval (region . %S) %s %S %d %d %S"
|
||||
(gds-send (format "eval (region . %S) %s %S %d %d %S %s"
|
||||
(gds-abbreviated code)
|
||||
(if module (prin1-to-string module) "#f")
|
||||
port-name (car lc) (cdr lc)
|
||||
code)
|
||||
code
|
||||
(if debugp '(debug) '(none)))
|
||||
gds-client))))
|
||||
|
||||
(defun gds-eval-expression (expr &optional correlator)
|
||||
"Evaluate the supplied EXPR (a string)."
|
||||
(interactive "sEvaluate expression: \nP")
|
||||
(defun gds-eval-expression (expr &optional correlator debugp)
|
||||
"Evaluate the supplied EXPR (a string). If invoked with `C-u'
|
||||
prefix (or, in a program, with optional DEBUGP arg non-nil), pause and
|
||||
pop up the stack at the start of the evaluation, so that the user can
|
||||
single-step through the code."
|
||||
(interactive "sEvaluate expression: \ni\nP")
|
||||
(or gds-client
|
||||
(gds-auto-associate-buffer)
|
||||
(call-interactively 'gds-associate-buffer))
|
||||
(set-text-properties 0 (length expr) nil expr)
|
||||
(gds-send (format "eval (%S . %S) #f \"Emacs expression\" 0 0 %S"
|
||||
(gds-send (format "eval (%S . %S) #f \"Emacs expression\" 0 0 %S %s"
|
||||
(or correlator 'expression)
|
||||
(gds-abbreviated expr)
|
||||
expr)
|
||||
expr
|
||||
(if debugp '(debug) '(none)))
|
||||
gds-client))
|
||||
|
||||
(defconst gds-abbreviated-length 35)
|
||||
|
@ -325,19 +333,25 @@ region's code."
|
|||
(concat (substring code 0 (- gds-abbreviated-length 3)) "...")
|
||||
code))
|
||||
|
||||
(defun gds-eval-defun ()
|
||||
"Evaluate the defun (top-level form) at point."
|
||||
(interactive)
|
||||
(defun gds-eval-defun (&optional debugp)
|
||||
"Evaluate the defun (top-level form) at point. If invoked with
|
||||
`C-u' prefix (or, in a program, with optional DEBUGP arg non-nil),
|
||||
pause and pop up the stack at the start of the evaluation, so that the
|
||||
user can single-step through the code."
|
||||
(interactive "P")
|
||||
(save-excursion
|
||||
(end-of-defun)
|
||||
(let ((end (point)))
|
||||
(beginning-of-defun)
|
||||
(gds-eval-region (point) end))))
|
||||
(gds-eval-region (point) end debugp))))
|
||||
|
||||
(defun gds-eval-last-sexp ()
|
||||
"Evaluate the sexp before point."
|
||||
(interactive)
|
||||
(gds-eval-region (save-excursion (backward-sexp) (point)) (point)))
|
||||
(defun gds-eval-last-sexp (&optional debugp)
|
||||
"Evaluate the sexp before point. If invoked with `C-u' prefix (or,
|
||||
in a program, with optional DEBUGP arg non-nil), pause and pop up the
|
||||
stack at the start of the evaluation, so that the user can single-step
|
||||
through the code."
|
||||
(interactive "P")
|
||||
(gds-eval-region (save-excursion (backward-sexp) (point)) (point) debugp))
|
||||
|
||||
;;;; Help.
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-07-17 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* gds-client.scm (handle-nondebug-protocol): Add support for
|
||||
setting a trap on code that is about to be evaluated.
|
||||
|
||||
2008-04-14 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* gds-client.scm (gds-debug-trap): Ensure that frame index passed
|
||||
|
|
|
@ -354,7 +354,7 @@ Thanks!\n\n"
|
|||
|
||||
((eval)
|
||||
(set! last-lazy-trap-context #f)
|
||||
(apply (lambda (correlator module port-name line column code)
|
||||
(apply (lambda (correlator module port-name line column code flags)
|
||||
(with-input-from-string code
|
||||
(lambda ()
|
||||
(set-port-filename! (current-input-port) port-name)
|
||||
|
@ -384,6 +384,11 @@ Thanks!\n\n"
|
|||
;; it to the list.
|
||||
(begin
|
||||
(for-each-breakpoint setup-after-read x)
|
||||
(if (and (pair? x)
|
||||
(memq 'debug flags))
|
||||
(install-trap (make <source-trap>
|
||||
#:expression x
|
||||
#:behaviour gds-debug-trap)))
|
||||
(loop (cons x exprs) (read))))))
|
||||
(lambda (key . args)
|
||||
(write-form `(eval-results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue