GNU bug report logs - #26662
Setting break on find-tail breaks the repl

Previous Next

Package: guile;

Reported by: Christopher Allan Webber <cwebber <at> dustycloud.org>

Date: Wed, 26 Apr 2017 03:37:02 UTC

Severity: normal

To reply to this bug, email your comments to 26662 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#26662; Package guile. (Wed, 26 Apr 2017 03:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 26 Apr 2017 03:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: bug-guile <at> gnu.org
Subject: Setting break on find-tail breaks the repl
Date: Tue, 25 Apr 2017 22:36:23 -0500
[Message part 1 (text/plain, inline)]
Setting a break on find-tail breaks everything at the repl:

  scheme@(guile-user)> ,break find-tail
  Trap 2: Breakpoint at #<procedure find-tail (_ _)>.
  scheme@(guile-user)> (+ 1 2 3)
  system/vm/traps.scm:127:31: system/vm/traps.scm:127:31: In procedure <: Wrong type: #f

  Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
  scheme@(guile-user) [1]> ,bt
  In system/repl/repl.scm:
     158:22  3 (_)
  In unknown file:
             2 (_)
  In system/vm/traps.scm:
     141:10  1 (apply-hook #<frame 7fff71aee2c0>)
     127:31  0 (_ _)
  scheme@(guile-user) [1]>

Not sure why, doesn't seem to happen with some other methods I've
tried... doesn't happen with map for instance.

I do have a patch, though I don't entirely understand what's going on.
Here's the relevant snippet of code:

  (define (frame-matcher proc)
    ;; [...]
    (let ((start (program-code proc))
          (end (program-last-ip proc)))
      (lambda (frame)
        (let ((ip (frame-instruction-pointer frame)))
          (and start end (<= start ip) (< ip end))))))

For some reason, `end' was #f in this scenario, which is how things
broke.  Well, patch attached!

[0001-Fix-frame-matcher-for-when-nothing-is-found-for-prog.patch (text/x-patch, inline)]
From 6bd0e814801d17df04ef23480647792480c08c26 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <cwebber <at> dustycloud.org>
Date: Tue, 25 Apr 2017 22:28:09 -0500
Subject: [PATCH] Fix frame-matcher for when nothing is found for
 program-last-ip.

* module/system/vm/traps.scm (frame-matcher): Check for end before
we compare it to anything, since it might be #f.
---
 module/system/vm/traps.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/system/vm/traps.scm b/module/system/vm/traps.scm
index c4861c925..43a067a76 100644
--- a/module/system/vm/traps.scm
+++ b/module/system/vm/traps.scm
@@ -124,7 +124,7 @@
             (end (program-last-ip proc)))
         (lambda (frame)
           (let ((ip (frame-instruction-pointer frame)))
-            (and (<= start ip) (< ip end))))))
+            (and end (<= start ip) (< ip end))))))
      ((struct? proc)
       (frame-matcher (procedure proc)))
      (else
-- 
2.12.2


This bug report was last modified 8 years and 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.