From: Michael Gopshtein (mgopshtein_at_[hidden])
Date: 2007-05-02 10:36:50
I've also uploaded our version to Vault (same location: Debug). Maybe we can
incorporate those versions together.
The code on Vaulnt is not based on Boost libraries yet, and can't be
compiled as stand-alone, but the concept should be clear.
"Michael Gopshtein" <mgopshtein_at_[hidden]> wrote in message
> We are using sort of stack strace library in our project, and I think it
> would be great to have something like that in boost.
> Many responses talk about using build-in compiler's capabilities. IMHO
> don't always help.
> As example, in our application we want the stack trace:
> 1) be always activated, even in release builds sent to the customers
> 2) be able to print the stack trace when exception occurs
> 1st is much easier using custom trace, as we don't need to compile the
> project with debug info. BTW, that "instrumentation" doesn't look so bad
> the code, and can sometimes replace comment lines, e.g:
> TRACE_UPDATE_CONTEXT("processing request");
> The 2nd task is more tricky, as if you don't catch the exception in same
> function where it occurs, but somewhere down the stack, the "normal" stack
> trace is lost. In our code we keep a "history" of call stacks, and can
> always print the whole stack.
> IMPLEMENTATION NOTES:
> 1) When exitting a function, the stack trace should be automatically
> notified. We did it by wrapping stack info with special class.
> 2) For multi-threaded application, separate stack should be kept for each
> thread. There need to be a way to initialize per-thread structures before
> using it.
> "Atry" <pop.atry_at_[hidden]> wrote in message
>> Java programs are easy to debug, one who catch an exception can print
>> the stack trace, and when it crash, it would print the stack, too. It is
>> useful, so I wrote some code of stack_trace for C++, see the sample
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk