mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
Add ,width meta-command to set screen width in debug output
This meta-command allows one to set the default number of columns that output from ,backtrace and ,locals shall occupy. * doc/ref/scheme-using.texi (Debug Commands): document ,width * module/system/repl/command.scm (*width*): new var (backtrace, locals): use *width* in optarg (width): new meta-command
This commit is contained in:
parent
c7d6f8b279
commit
47b86dbf4d
2 changed files with 24 additions and 3 deletions
|
@ -337,6 +337,12 @@ Show the VM registers associated with the current frame.
|
||||||
@xref{Stack Layout}, for more information on VM stack frames.
|
@xref{Stack Layout}, for more information on VM stack frames.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {REPL Command} width [cols]
|
||||||
|
Sets the number of display columns in the output of @code{,backtrace}
|
||||||
|
and @code{,locals} to @var{cols}. If @var{cols} is not given, the width
|
||||||
|
of the terminal is used.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
The next 3 commands work at any REPL.
|
The next 3 commands work at any REPL.
|
||||||
|
|
||||||
@deffn {REPL Command} break proc
|
@deffn {REPL Command} break proc
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
(define *show-table*
|
(define *show-table*
|
||||||
'((show (warranty w) (copying c) (version v))))
|
'((show (warranty w) (copying c) (version v))))
|
||||||
|
|
||||||
|
(define *width* 72)
|
||||||
|
|
||||||
(define (group-name g) (car g))
|
(define (group-name g) (car g))
|
||||||
(define (group-commands g) (cdr g))
|
(define (group-commands g) (cdr g))
|
||||||
|
|
||||||
|
@ -546,7 +548,7 @@ Trace execution."
|
||||||
(format #t "Nothing to debug.~%"))))))))
|
(format #t "Nothing to debug.~%"))))))))
|
||||||
|
|
||||||
(define-stack-command (backtrace repl #:optional count
|
(define-stack-command (backtrace repl #:optional count
|
||||||
#:key (width 72) full?)
|
#:key (width *width*) full?)
|
||||||
"backtrace [COUNT] [#:width W] [#:full? F]
|
"backtrace [COUNT] [#:width W] [#:full? F]
|
||||||
Print a backtrace.
|
Print a backtrace.
|
||||||
|
|
||||||
|
@ -626,12 +628,12 @@ With an argument, select a frame by index, then show it."
|
||||||
Print the procedure for the selected frame."
|
Print the procedure for the selected frame."
|
||||||
(repl-print repl (frame-procedure cur)))
|
(repl-print repl (frame-procedure cur)))
|
||||||
|
|
||||||
(define-stack-command (locals repl)
|
(define-stack-command (locals repl #:key (width *width*))
|
||||||
"locals
|
"locals
|
||||||
Show local variables.
|
Show local variables.
|
||||||
|
|
||||||
Show locally-bound variables in the selected frame."
|
Show locally-bound variables in the selected frame."
|
||||||
(print-locals cur))
|
(print-locals cur #:width width))
|
||||||
|
|
||||||
(define-stack-command (error-message repl)
|
(define-stack-command (error-message repl)
|
||||||
"error-message
|
"error-message
|
||||||
|
@ -811,6 +813,19 @@ Print registers.
|
||||||
Print the registers of the current frame."
|
Print the registers of the current frame."
|
||||||
(print-registers cur))
|
(print-registers cur))
|
||||||
|
|
||||||
|
(define-meta-command (width repl #:optional x)
|
||||||
|
"width [X]
|
||||||
|
Set debug output width.
|
||||||
|
|
||||||
|
Set the number of screen columns in the output from `backtrace' and
|
||||||
|
`locals'."
|
||||||
|
(if (and x (not (integer? x)))
|
||||||
|
(error "expected a column number (a non-negative integer)" x)
|
||||||
|
(let ((w (or x
|
||||||
|
(false-if-exception (string->number (getenv "COLUMNS")))
|
||||||
|
72)))
|
||||||
|
(format #t "Setting screen width to ~a columns~%" w)
|
||||||
|
(set! *width* w))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue