guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tracing and traping?


From: Andy Wingo
Subject: Re: tracing and traping?
Date: Sat, 17 Apr 2010 13:16:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Stefan,

On Fri 16 Apr 2010 19:47, stefan <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]