diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-07-14 02:08:50 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-07-14 02:08:50 +0200 |
commit | e1d95d6e98fa4741d1e7092c9233dc13c1a95a78 (patch) | |
tree | 58105aba5e6c39232973816206e10747116e9bac /test/core/util/test_config.c | |
parent | 294d9726297c041b0e0409b0fc33300424662f20 (diff) |
Adding a handler for abort().
We want to have a chance to debug a call to abort() in case we have a debugger attached.
Diffstat (limited to 'test/core/util/test_config.c')
-rw-r--r-- | test/core/util/test_config.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index ba62e6d4c4..225658f5e2 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -66,10 +66,20 @@ LONG crash_handler(struct _EXCEPTION_POINTERS* ex_info) { return EXCEPTION_EXECUTE_HANDLER; } +void abort_handler(int sig) { + gpr_log(GPR_DEBUG, "Abort handler called."); + if (IsDebuggerPresent()) { + __debugbreak(); + } else { + _exit(1); + } +} + static void install_crash_handler() { SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) crash_handler); _set_abort_behavior(0, _WRITE_ABORT_MSG); _set_abort_behavior(0, _CALL_REPORTFAULT); + signal(SIGABRT, abort_handler); } #else static void install_crash_handler() { } |