Here is a code to have a debug printf :
#ifdef DEBUG
#define DEBUG_printf(...)
{printf("[%s]:",__FUNCTION__)

rintf(__VA_ARGS__)

rintf("\n"); }
#else
#define DEBUG
#endif
int main () {
DEBUG_printf ("%d %s", 5, "abc");
}
Is there something similar, which can print the current stack ?
I mean some C/C++ API which can me get any info related to the
current stack of functions.
Thats is required for debugging.
(Please do not suggest gdb... I want something similar to gdb stack
traces but that should print stack info everytime I compile with DEBUG
on)