Han-Wen Nienhuys escreveu: > I'd like to run a coverage check on the lilypond source. > How do I do this in GUILE?
Since noone responded, I decided to take a look myself. My overall idea was to do the following: - at the top of deval(), find out current source file and line - invoke some kind of callback that increments a counter for the source location - produce pretty pretty coverage graphs with the contents of the hash The last two steps are trivial, but I'm getting lost with the first step. I tried to follow what happens when an error backtrace is generated. My try is below. Unfortunately, I can't find much documentation on how frames/stacks/etc. interact. Can anyone gently nudge me in the right direction? diff -p -u -u -r1.408 eval.c --- eval.c 9 Oct 2006 23:10:31 -0000 1.408 +++ eval.c 8 Jan 2007 23:39:39 -0000 @@ -3230,6 +3230,13 @@ eval_letrec_inits (SCM env, SCM init_for * If, however, x represents some form that requires to evaluate a sequence of * expressions like (begin exp1 exp2 ...), then recursive calls to CEVAL are * performed for all but the last expression of that sequence. */ +#include "stacks.h" +#include <stdio.h> + +void +read_frame (scm_t_debug_frame const *dframe, scm_t_ptrdiff offset, + scm_t_info_frame *iframe); +int scm_do_profiling; static SCM CEVAL (SCM x, SCM env) @@ -3263,6 +3270,34 @@ CEVAL (SCM x, SCM env) } #endif + +#ifdef DEVAL + if (scm_do_profiling) + { + struct scm_t_info_frame info_frame; + SCM source; + SCM file; + SCM line; + + read_frame (&debug, 0, &info_frame); + + source = info_frame.source; + file = SCM_MEMOIZEDP (source) ? scm_source_property (source, scm_sym_filename) : SCM_BOOL_F; + line = (SCM_MEMOIZEDP (source)) ? scm_source_property (source, scm_sym_line) : SCM_BOOL_F; + + if (scm_is_true (line) + && scm_is_true (file)) + { + printf ("%s %d - size %ld\n", scm_i_string_chars (file), scm_to_int (line), scm_debug_eframe _size); + } + else + { + scm_display (source, scm_current_output_port ()); + scm_puts ("\n", scm_current_output_port ()); + } + } +#endif -- Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel