unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: 26662@debbugs.gnu.org
Subject: bug#26662: Setting break on find-tail breaks the repl
Date: Tue, 25 Apr 2017 22:36:23 -0500	[thread overview]
Message-ID: <87wpa7u9fs.fsf@dustycloud.org> (raw)

[-- 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


                 reply	other threads:[~2017-04-26  3:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpa7u9fs.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=26662@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).