Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-04-20 19:21:22


Dirk Reiners wrote:
> Hi All,
>
> I would be very interested, but having to instrument the code makes the use too
> complicated IMHO.

I agree, that's what logging is for...course we don't have that lib either :-(

> There are some systems out there that do stack traces (I know VRJuggler does
> them, and so does bugle, and probably many others), so there is probably code to
> start with, if somebody wants to give it a try. The system-dependence and symbol
> demangling makes it somewhat painful...
>

The code I pointed to earlier uses non-standard API calls (others have pointed
out similar facilities) to get a stack trace. Ultimately at the next layer up
what I want is something like:

//snaps stack state at time of construction
class FancyException : std::exception()
public:
    FancyException(const std::string& what);
    std::string backtrace()
}:

...
throw FancyException("Oh no");

...
catch (FancyException& e) {
   std::cerr << e.what() << std::endl;
   std::cerr << e.backtrace() << std::endl;
}

Or you could have a vector of strings for each stack element. I think
something like this could be done as a portable interface...it's just you'd
get different information in the trace depending on how things are compiled,
what platform, etc.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk