Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-04-20 12:24:26

On 04/20/2007 12:04 PM, Atry wrote:
> 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 below:
The trace_scope_stk template here:

is related. I've not used it in quite a while; so, the following
description may not be entirely accurate. To use it, us must
declare an instance of the template at each scope entry. When
the program runs, it prints an indented message when entrying the scope
and again when exiting the scope. The indentation reflects the
depth of the call stack. The elements in the call stack are also
stored in a stack which, I'd expect, you can print out somehow.
Just from a brief glance at your code, it looks like you also have to
put some code at the start of each scope entry and I guess the code
pushes something onto the stack (line and file number) which can
then be printed when an exception is thrown.

It would be nice to merge these two.

Boost list run by bdawes at, gregod at, cpdaniel at, john at