guile-commits
[Top][All Lists]
Advanced

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

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


From: Mark H. Weaver
Subject: [Guile-commits] 01/02: Work around requirement that size be non-zero in GDB 'open-memory'.
Date: Fri, 27 Mar 2015 03:18:28 +0000

mhw pushed a commit to branch stable-2.0
in repository guile.

commit 4ab9f0f8b94d6d2cebd667a35ca7f9f616eca356
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 |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

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



reply via email to

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