1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-30 23:10:21 +02:00

Work around requirement that size be non-zero in GDB 'open-memory'.

* module/system/base/types.scm (memory-port): Handle zero size case
  specially.
This commit is contained in:
Mark H Weaver 2015-03-26 22:51:16 -04:00 committed by Andy Wingo
parent d848067b89
commit 8dcf3c6163

View file

@ -117,8 +117,12 @@ SIZE is omitted, return an unbounded port to the memory at ADDRESS."
(let ((open (memory-backend-open backend))) (let ((open (memory-backend-open backend)))
(open address #f))) (open address #f)))
((_ backend address size) ((_ backend address size)
(if (zero? size)
;; GDB's 'open-memory' raises an error when size
;; is zero, so we must handle that case specially.
(open-bytevector-input-port '#vu8())
(let ((open (memory-backend-open backend))) (let ((open (memory-backend-open backend)))
(open address size))))) (open address size))))))
(define (get-word port) (define (get-word port)
"Read a word from PORT and return it as an integer." "Read a word from PORT and return it as an integer."