Hi Stefan,

On Fri 16 Apr 2010 19:47, stefan <stefan.ta...@spray.se> writes:

> I learned to like to trace functions when 
> debugging and found out that guiles version needs work.
>  so has anybody steped up to fix this?

It's possible to trace the execution of a whole tree of functions:

  scheme@(guile-user)> ,trace (module-ref (current-module) 'assoc)
  |(current-module)
  |#<directory (guile-user) 86f3738>
  (module-ref #<directory (guile-user) 86f3738> assoc)
  |(module-variable #<directory (guile-user) 86f3738> assoc)
  ||(b #<autoload (system base compile) 86f36c8> assoc #f)
  |||(memq assoc (compile))
  |||#f
  ||#f
  ||(b #<autoload (system vm debug) 88a0bd0> assoc #f)
  |||(memq assoc (debug))
  |||#f
  ||#f
  |#<variable 86eddc8 value: #<procedure assoc (_ _)>>
  #<procedure assoc (_ _)>

In this case we actually cache the value in a local imports obarray, so
the next time is faster:

  scheme@(guile-user)> ,trace (module-ref (current-module) 'assoc)
  |(current-module)
  |#<directory (guile-user) 86f3738>
  (module-ref #<directory (guile-user) 86f3738> assoc)
  |(module-variable #<directory (guile-user) 86f3738> assoc)
  |#<variable 86eddc8 value: #<procedure assoc (_ _)>>
  #<procedure assoc (_ _)>


This system-wide trace facility is exposed in (system vm trace). An
older function-specific trace facility was defined in (ice-9 debug), but
it needs to be updated, probably to use (system vm trace). (system vm
trace) needs to be enhanced to support profiling only certain functions,
perhaps via a predicate kwarg.

Andy
-- 
http://wingolog.org/


Reply via email to