member functions call tracer

shinichiro.h dng at shinh.skr.jp
Sat Feb 16 04:57:28 PST 2008


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.



More information about the Digitalmars-d mailing list