This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

function entry+exit echo,


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]