1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

add source:line-for-user, returning a 1-indexed line number

* module/system/vm/program.scm (source:line-for-user): New exported
  procedure, returns a 1-indexed line, suitable for presentation to a
  user.
  (write-program): Use source:line-for-user when making fallback names.

* module/system/vm/coverage.scm (coverage-data->lcov):
* module/language/assembly/disassemble.scm (source->string):
* module/system/repl/debug.scm (print-frame): Use source:line-for-user.
This commit is contained in:
Andy Wingo 2010-10-01 18:15:23 +02:00
parent c005daf923
commit e867d563a5
4 changed files with 13 additions and 6 deletions

View file

@ -332,10 +332,10 @@ gathered, even if their code was not executed."
(and (program? proc)
(let ((sources (program-sources* data proc)))
(and (pair? sources)
(let* ((line (source:line (car sources)))
(let* ((line (source:line-for-user (car sources)))
(name (or (procedure-name proc)
(format #f "anonymous-l~a" (+ 1 line)))))
(format port "FN:~A,~A~%" (+ 1 line) name)
(format #f "anonymous-l~a" line))))
(format port "FN:~A,~A~%" line name)
(and=> (procedure-execution-count data proc)
(lambda (count)
(format port "FNDA:~A,~A~%" count name))))))))