From: Russell Hind (rhind_at_[hidden])
Date: 2003-03-19 06:17:17
Trevor Taylor wrote:
> As a software user I am frequently frustrated by "an error occurred"
> like failure messages. As a developer I know that the software *knows*
> exactly what failed, why, and exactly what it was doing at the time, but
> doesn't pass any of this information on.
> Recently I developed some C++ where for the first time I was happy with
> the information reported in error cases. The key to happiness, it
> turned out, was to collect "context" with exceptions as they propogated
> (back) up the call chain.
> I would love boost to provide an exception class/framework/something
> with this capability to encourage collection of context information,
> which would make problem diagnosis so much easier.
IIRC, there was discussion of a library to help getting callstact info
etc a few months back, but can't quite remember what the result was. I
have basic info on doing this in C++Builder on Windows (and use it in
our software) and it could esaily be applied to VC++, but as for other
platforms, I'm affraid I can't help.
For BCB, have a look at http://www.wischik.com/lu/programmer/index.html
and look at the debugging aids section. This could also easily be
applied to VC++ as well, but I haven't tried it under that. We use it
to generate a callstack in an assert which can be very useful. You
could also use it to look up the method name during an access violation
or some other exception that can get thrown.
I have also had some success using a try...__except block to get the
CONTEXT as you mentioned and produce a callstack from that, but usually
the last few entries are missing. You can always fill in the last entry
for the exception address, but I don't know how much you can trust the
stack at that point because, as far as I know, it has started unwinding.
I don't think windows keeps a copy of it with the exception record so
you can walk it once the exception has been thrown.
> Perhaps I could relate some of my experience and put some ideas up
> for discussion?
> 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