function entry+exit echo,

lazer1 lazer1@blueyonder.co.uk
Tue Sep 13 12:49:00 GMT 2005


Hello,

can I customise gcc so that when code is compiled
function entry and exit is customised,

eg if

f( ........ )
{
....
}

is compiled, I'd like on entry of f eg a shell echo to happen:


if(some_env_variable_is_set())
   {
   int i ;
   for( i = 0 ; i < nest_count ; i++ )printf(" ") ;
   printf("%s %d %d{\n", __FILE__, __LINE__, nest_count );
   }
nest_count++ ;


and at all exit points
if( some_env_variable_is_set() )
   {
   int i ;
   for( i = 0 ; i < nest_count ; i++ )printf(" ") ;
   printf("}\n")
   }
nest_count-- ;

where nest_count is a global variable and some_env_variable_is_set() is 
a function I've defined, (I'll write the latter function in a way to prevent
infinite recursion for when it is compiled!)


that way for debugging I can by setting the env variable 
locally track all function calls,

in case it is relevant I'm interested in this for 68k and PPC gcc's,





------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list