unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* How to record source properties for all symbols?
@ 2018-06-03 19:48 Fis Trivial
  2018-06-04 10:07 ` Mark H Weaver
  0 siblings, 1 reply; 4+ messages in thread
From: Fis Trivial @ 2018-06-03 19:48 UTC (permalink / raw)
  To: guile-devel

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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-05 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-03 19:48 How to record source properties for all symbols? Fis Trivial
2018-06-04 10:07 ` Mark H Weaver
2018-06-04 15:41   ` Fis Trivial
2018-06-05 22:09     ` Mark H Weaver

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).