This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Customizing uncaught exception messages


Yang Zhang <yanghatespam@gmail.com> writes:

> I guess my question boils down to: how do I do the first thing you
> mentioned - that is, cause all throws to trigger my own code (which
> e.g. calls backtrace())?  I've used backtrace() and addr2line before,
> but I just don't know enough about how C++ exceptions work.

Use the standard set_terminate function to create your own terminate
handler.  It will be called for exceptions which aren't caught.

If you want to be called for exception which are caught, you need to
hook into __cxa_throw.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]