guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 09/47: Work around requirement that size be non-zero in


From: Andy Wingo
Subject: [Guile-commits] 09/47: Work around requirement that size be non-zero in GDB 'open-memory'.
Date: Sun, 22 May 2016 18:23:03 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit 8dcf3c6163bba444cd459d9ffd22cc5f627fe6c8
Author: Mark H Weaver <address@hidden>
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

[Prev in Thread] Current Thread [Next in Thread]