mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-08 10:50:21 +02:00
* boot-9.scm (scm-style-repl): After reading an expression,
consume any trailing newline (perhaps preceded by whitespace), to avoid screwing up GDB. More detail in comments.
This commit is contained in:
parent
d53f4df2ea
commit
480977d064
1 changed files with 22 additions and 0 deletions
|
@ -2347,6 +2347,17 @@
|
|||
(* 1000 (/ (- (gc-run-time) start-gc-rt)
|
||||
internal-time-units-per-second))))
|
||||
(display " msec in gc)\n")))
|
||||
|
||||
(consume-trailing-whitespace
|
||||
(lambda ()
|
||||
(let ((ch (peek-char)))
|
||||
(cond
|
||||
((eof-object? ch))
|
||||
((or (char=? ch #\space) (char=? ch #\tab))
|
||||
(read-char)
|
||||
(consume-trailing-whitespace))
|
||||
((char=? ch #\newline)
|
||||
(read-char))))))
|
||||
(-read (lambda ()
|
||||
(if scm-repl-prompt
|
||||
(begin
|
||||
|
@ -2359,6 +2370,17 @@
|
|||
(repl-report-reset)))
|
||||
(run-hooks before-read-hook)
|
||||
(let ((val (read (current-input-port))))
|
||||
;; As described in R4RS, the READ procedure updates the
|
||||
;; port to point to the first characetr past the end of
|
||||
;; the external representation of the object. This
|
||||
;; means that it doesn't consume the newline typically
|
||||
;; found after an expression. This means that, when
|
||||
;; debugging Guile with GDB, GDB gets the newline, which
|
||||
;; it often interprets as a "continue" command, making
|
||||
;; breakpoints kind of useless. So, consume any
|
||||
;; trailing newline here, as well as any whitespace
|
||||
;; before it.
|
||||
(consume-trailing-whitespace)
|
||||
(run-hooks after-read-hook)
|
||||
(if (eof-object? val)
|
||||
(begin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue