function logging

Calin Vatavu cvatavu@bumerang.ro
Tue Apr 16 08:37:00 GMT 2002


I'm trying to log EVERY function call in a library (gtk+ for example) and I 
did it by inserting the line: 

int dummy = printf (" %s %d", __FILE__, __LINE__); 

in ALL functions (at the beginning). I used a perl script which can, 
ofcourse, be fooled in some cases (like enum {...). thus I think I need a 
c-parser which can give me the position of the starting of the function body 
in the file.
Cab gcc give me the access to its internals to accomplish this ? 

And a second problem, how can I know the caller of the current function 
(like the perl's caller() function) ?
I need the backtrace in every function call. 

Does anybody know some debugging tricks like this ? 



More information about the Gcc-help mailing list