wingo pushed a commit to branch master
in repository guile.

commit 8dcf3c6163bba444cd459d9ffd22cc5f627fe6c8
Author: Mark H Weaver <[email protected]>
Date:   Thu Mar 26 22:51:16 2015 -0400

    Work around requirement that size be non-zero in GDB 'open-memory'.
    
    * module/system/base/types.scm (memory-port): Handle zero size case
      specially.
---
 module/system/base/types.scm |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/module/system/base/types.scm b/module/system/base/types.scm
index ea2f3bc..7368171 100644
--- a/module/system/base/types.scm
+++ b/module/system/base/types.scm
@@ -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."

Reply via email to