Customizing uncaught exception messages

Ian Lance Taylor iant@google.com
Thu May 15 16:05:00 GMT 2008


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



More information about the Gcc-help mailing list