bug-guile
[Top][All Lists]
Advanced

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

bug#26662: Setting break on find-tail breaks the repl


From: Christopher Allan Webber
Subject: bug#26662: Setting break on find-tail breaks the repl
Date: Tue, 25 Apr 2017 22:36:23 -0500
User-agent: mu4e 0.9.18; emacs 25.2.1

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!

>From 6bd0e814801d17df04ef23480647792480c08c26 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <address@hidden>
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


reply via email to

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