www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - member functions call tracer

Hi,

I wrote a toy program which enables us to record function calls.

http://shinh.skr.jp/d/tracer.tgz

Example:

 % cat example.d
 import tracer;

 class C {
     void f() {
         g();
     }
     void g() {
     }
 }

 void main() {
     initTracer();
     C c = new C();
     c.f();
 }
 % dmd example.d tracer.d
 gcc-3.4 example.o tracer.o -o example -m32 -lphobos2 -lpthread -lm
 % example
 % ./dumptrace example
 void example.C.f()  0804a382 (from _Dmain  0804a3bc)
 void example.C.g()  0804a394 (from void example.C.f()  0804a38a)

Because this program uses invariant functions as hook functions, this
program cannot trace global/static functions.
Feb 16 2008