1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 07:50:20 +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
parent 61e1c2130c
commit 4ab9f0f8b9

View file

@ -1,5 +1,5 @@
;;; 'SCM' type tag decoding.
;;; Copyright (C) 2014 Free Software Foundation, Inc.
;;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU Lesser General Public License as published by
@ -117,8 +117,12 @@ SIZE is omitted, return an unbounded port to the memory at ADDRESS."
(let ((open (memory-backend-open backend)))
(open address #f)))
((_ backend address size)
(let ((open (memory-backend-open backend)))
(open 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)))
(open address size))))))
(define (get-word port)
"Read a word from PORT and return it as an integer."