debug

debug — Debugging macros & functions.

Synopsis




#define     ENTER_FUNC
#define     LEAVE_FUNC
#define     DEBUG                           (...)
void        enter_func                      (const char *name);
void        leave_func                      (const char *name);
void        dbg                             (const char *func,
                                             const char *format,
                                             ...);

Description

Alarmd internal debugging macros & functions.

Details

ENTER_FUNC

#define     ENTER_FUNC

Indicates that we're entering a function. Displays a message and increments the indentation in the debugging output.


LEAVE_FUNC

#define     LEAVE_FUNC

Indicates that we're leaving a function. Displays a message and decrements the indentation in the debugging output.


DEBUG()

#define     DEBUG(...)

Writes a debug message to stdout with the current indentation level.

... :

enter_func ()

void        enter_func                      (const char *name);

Should be called as ENTER_FUNC at start of a function.

name : Name of function being entered.

leave_func ()

void        leave_func                      (const char *name);

Should be called as LEAVE_FUNC at the end of a function.

name : Name of function being entered.

dbg ()

void        dbg                             (const char *func,
                                             const char *format,
                                             ...);

Writes a debug message; should be used through DEBUG macro.

func : Name of function writing debug info.
format : Format for the message being printed (printf like).
... : Values to fill into the format string.