What do you mean with tracing embedded code? You mean adding trace logging?
These are two logging macros which I have put in a file which I use in my home projects.
Code:
#ifdef USE_TRACE_LOGGING
#define LOG_TRACE_ENTRY printf ("LOGGING: TRACE-ENTRY %s\n", __FUNCTION__);
#define LOG_TRACE_EXIT printf ("LOGGING: TRACE-EXIT %s\n", __FUNCTION__);
#else
#define LOG_TRACE_ENTRY(fn)
#define LOG_TRACE_EXIT(fn)
#endif
By turning the compiler switch USE_TRACE_LOGGING on, the macros will print some text to the screen. If the compiler switch is not turned on, then nothing is done. You can use it like this in your functions:
Code:
int function ()
{
LOG_TRACE_ENTRY;
LOG_TRACE_EXIT;
}
Note that __FUNCTION__ is a GCC specific feature which gives the name of the function. So it is not ANSI C.