diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-09-24 15:39:10 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-09-24 15:39:47 +0200 |
commit | 6edf58538f852102a80b0fce84e85ffca3c78c96 (patch) | |
tree | ac41218ea424636c6968d0d733d3f5e78fa6d87a | |
parent | 639b2eb7107b26207d13bb8acb4c1d38d7dba3bd (diff) | |
download | guile-6edf58538f852102a80b0fce84e85ffca3c78c96.tar.gz |
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)).
-rw-r--r-- | module/system/vm/coverage.scm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/module/system/vm/coverage.scm b/module/system/vm/coverage.scm index 0f4c73ec9..17e2f40eb 100644 --- a/module/system/vm/coverage.scm +++ b/module/system/vm/coverage.scm @@ -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 was executed is returned, not the number of times this code associated with this particular closure was executed." - (and=> (hashx-ref hashq-proc assq-proc - (data-procedure->ip-counts data) proc) - (let ((sources (program-sources* data proc))) - (lambda (ip-counts) - (let ((entry-ip (source:addr (car sources)))) ;; FIXME: broken with lambda* - (hashv-ref ip-counts entry-ip 0)))))) + (let ((sources (program-sources* data proc))) + (and (pair? sources) + (and=> (hashx-ref hashq-proc assq-proc + (data-procedure->ip-counts data) proc) + (lambda (ip-counts) + ;; FIXME: broken with lambda* + (let ((entry-ip (source:addr (car sources)))) + (hashv-ref ip-counts entry-ip 0))))))) (define (program-sources* data proc) ;; A memoizing version of `program-sources'. |