mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
Make `procedure-execution-count' fail gracefully when no source info is available.
* module/system/vm/coverage.scm (procedure-execution-count): Handle the case where (null? (program-sources PROC)).
This commit is contained in:
parent
639b2eb710
commit
6edf58538f
1 changed files with 8 additions and 6 deletions
|
@ -199,12 +199,14 @@ coverage data. Return code coverage data and the values returned by THUNK."
|
||||||
if PROC was not executed. When PROC is a closure, the number of times its code
|
if PROC was not executed. When PROC is a closure, the number of times its code
|
||||||
was executed is returned, not the number of times this code associated with this
|
was executed is returned, not the number of times this code associated with this
|
||||||
particular closure was executed."
|
particular closure was executed."
|
||||||
|
(let ((sources (program-sources* data proc)))
|
||||||
|
(and (pair? sources)
|
||||||
(and=> (hashx-ref hashq-proc assq-proc
|
(and=> (hashx-ref hashq-proc assq-proc
|
||||||
(data-procedure->ip-counts data) proc)
|
(data-procedure->ip-counts data) proc)
|
||||||
(let ((sources (program-sources* data proc)))
|
|
||||||
(lambda (ip-counts)
|
(lambda (ip-counts)
|
||||||
(let ((entry-ip (source:addr (car sources)))) ;; FIXME: broken with lambda*
|
;; FIXME: broken with lambda*
|
||||||
(hashv-ref ip-counts entry-ip 0))))))
|
(let ((entry-ip (source:addr (car sources))))
|
||||||
|
(hashv-ref ip-counts entry-ip 0)))))))
|
||||||
|
|
||||||
(define (program-sources* data proc)
|
(define (program-sources* data proc)
|
||||||
;; A memoizing version of `program-sources'.
|
;; A memoizing version of `program-sources'.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue