unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Fis Trivial <ybbs.daans@hotmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: How to record source properties for all symbols?
Date: Sun, 3 Jun 2018 19:48:05 +0000	[thread overview]
Message-ID: <BLUPR16MB0500B847327D6F5D7D640D0192600@BLUPR16MB0500.namprd16.prod.outlook.com> (raw)

Hi, guiles.

I'm new to scheme and guile. Most of the time, I am a c/c++ and python
programmer. One thing that bugs me about writing scheme with guile is
that I can't have full source information when reading backtrace.

For example, in the following snippet (test.scm):
----------------
(use-modules (ice-9 pretty-print))
(define (function)
  (format #t "function"))
(define* (function-asterisk)
  (format #t "asterisk"))

(format #t "function properties:~a~%" (source-properties function))
(format #t "asterisk properties:~a~%" (source-properties function-asterisk))

(define var "normal var")

(format #t "normal var properties:~a~%" (source-properties var))
----------------

With guile-2.2.3, running $guile ./test.scm , I got the following
result:

----------------
function properties:()
asterisk properties:()
normal var properties:((line . 9) (column . 12) (filename . /home/fis/Others/git-repos/compliers/guile/./test.scm))
----------------

In which you can see, only `var' has non-empty
source-properties. Further, if I enter the above snippet in guile shell,
then source-properties is not recorded even for `var'. I tried to dig in
the source code of guile, so far I have found two related functions:

`scm_primitive_load' in load.c
`maybe_annotate_source' in read.c.

Using gdb to break on these two function doesn't stop the process. Only
running (primitive-load "test.scm") inside guile shell invoke these two
functions. The finding is far away from knowing how to make guile record
source information for every symbols.

Can you give me some guidance for how to achieve the goal(record all
source information for every symbol). If it's theoretically impossible
or hard to achieve, can you give me some inside why and advises for
making best effort? I intend to help, so pointers to internal structures
are also welcomed.

Thanks in advance.



             reply	other threads:[~2018-06-03 19:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03 19:48 Fis Trivial [this message]
2018-06-04 10:07 ` How to record source properties for all symbols? Mark H Weaver
2018-06-04 15:41   ` Fis Trivial
2018-06-05 22:09     ` Mark H Weaver

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=BLUPR16MB0500B847327D6F5D7D640D0192600@BLUPR16MB0500.namprd16.prod.outlook.com \
    --to=ybbs.daans@hotmail.com \
    --cc=guile-devel@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).