Exception Stack Trace Question.
Though catch(.) statement allows catching exception not associated with any class, it leads to ambiguous condition as there is no way to have any error message with it. Does Boost provide any means to be able to print stack trace when exception is caught ? In spite of many deficiencies with Java, it let's you access stack trace using printStackTrace() and trace out as what happened and how it happened. This is where C++ std::exception is lacking support and one has to look for such improvements from Boost community.
"Piyush Kapadia"
Though catch(.) statement allows catching exception not associated with any class, it leads to ambiguous condition as there is no way to have any error message with it.
Does Boost provide any means to be able to print stack trace when exception is caught ?
No, Boost doesn't provide that. It isn't possible to implement that feature portably; in fact by the time you reach catch(...) the stack trace information may be completely gone. -- Dave Abrahams Boost Consulting www.boost-consulting.com
On Fri, 14 Oct 2005 00:30:18 -0400, David Abrahams wrote
"Piyush Kapadia"
writes: Though catch(.) statement allows catching exception not associated with any class, it leads to ambiguous condition as there is no way to have any error message with it.
Does Boost provide any means to be able to print stack trace when exception is caught ?
No, Boost doesn't provide that. It isn't possible to implement that feature portably; in fact by the time you reach catch(...) the stack trace information may be completely gone.
It can be done for user exceptions by snapping the stack at the point of the exception throw. There's some really old stuff that was proposed a couple years back this. I haven't used this on a real project and obviously it hasn't been reviewed, so 'buyer beware'. You'll need a Yahoo id to see these files. http://groups.yahoo.com/group/boost/files/StackTraces/ Jeff
David Abrahams wrote:
"Piyush Kapadia"
writes: Though catch(.) statement allows catching exception not associated with any class, it leads to ambiguous condition as there is no way to have any error message with it.
Does Boost provide any means to be able to print stack trace when exception is caught ?
No, Boost doesn't provide that. It isn't possible to implement that feature portably; in fact by the time you reach catch(...) the stack trace information may be completely gone.
Agree with that. For instance the microsoft visual studio compiler implemented C++ exceptions on top of windows structured exceptions. Totally compiler depended. Using this however yields a method of retrieving the stack trace for this compiler. See http://blog.kalmbachnet.de/files/StackWalker.zip
participants (4)
-
David Abrahams
-
Jeff Garland
-
Okko Willeboordse
-
Piyush Kapadia