Move exception_handler into libbase. Add handler for SIGABRT.

Fixes #3590