unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Robin Templeton <robin@terpri.org>
To: 24320@debbugs.gnu.org
Subject: bug#24320: Error when printing foreign functions
Date: Sat, 27 Aug 2016 14:05:25 -0400	[thread overview]
Message-ID: <871t1auly2.fsf@panthera.terpri.org> (raw)

The following program causes `(@ (system vm program) print-program)' to
throw an exception when run in Guile 2.1.3.104-8f2f8:

(use-modules (system foreign))
(format #t "~S~%"
 (pointer->procedure double
                     (dynamic-func "sqrt" (dynamic-link))
                     (list double)))

print-program tries to access fields of the procedure's debug info
record even if find-program-debug-info fails and returns #f. The
following patch fixes the problem.

From 0ec7bff9e71f1c1c46fa3c1d2bdbc43f5db3588c Mon Sep 17 00:00:00 2001
From: Robin Templeton <robin@terpri.org>
Date: Sat, 27 Aug 2016 13:42:10 -0400
Subject: [PATCH] Check for missing debug info in print-program

* module/system/vm/program.scm (print-program): Check the return value
  of find-program-debug-info.
---
 module/system/vm/program.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index 9f5b764..32c96f2 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -265,7 +265,7 @@ lists."
          ;; It could be the procedure had its name property set via the
          ;; procedure property interface.
          (name (or (and program (procedure-name program))
-                   (program-debug-info-name pdi)))
+                   (and pdi (program-debug-info-name pdi))))
          (source (match (find-program-sources addr)
                    (() #f)
                    ((source . _) source)))
-- 
2.9.3







             reply	other threads:[~2016-08-27 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27 18:05 Robin Templeton [this message]
2016-09-02  8:08 ` bug#24320: Error when printing foreign functions Andy Wingo
2016-09-03  1:38   ` Robin Templeton

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=871t1auly2.fsf@panthera.terpri.org \
    --to=robin@terpri.org \
    --cc=24320@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).