unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#26662: Setting break on find-tail breaks the repl
@ 2017-04-26  3:36 Christopher Allan Webber
  0 siblings, 0 replies; only message in thread
From: Christopher Allan Webber @ 2017-04-26  3:36 UTC (permalink / raw)
  To: 26662

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

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!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-frame-matcher-for-when-nothing-is-found-for-prog.patch --]
[-- Type: text/x-patch, Size: 953 bytes --]

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-26  3:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26  3:36 bug#26662: Setting break on find-tail breaks the repl Christopher Allan Webber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).