On Oct 16, 7:55 pm, call_me_anything <sgiitne...@gmail.com> 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)
Nothing standard. In fact, any solution will be very platform
dependent. (My site has a stack trace class with
implementations for i80x86, 64 bit AMD, and 32 and 64 bit
Sparcs. But you still have to pay attention---changing the
compiler options can change it as well. Still, it might be a
start.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34