call_me_anything wrote:
> 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)
There are platform specific mechanisms that allow you to get a stack
trace. The Austria C++ "netcabletv" alpha contains a stack trace API
that works on win32 and linux.