xroche/coffeecatch

Not work on catching divide by zero error

Opened this issue · 0 comments

static __attribute__ ((noinline)) void demo(int *fault) {
    COFFEE_TRY() {
        LOGD("_TEST", "num div:%d", 1 / (*fault));
        *fault = 0;
    } COFFEE_CATCH() {
        const char*const message = coffeecatch_get_message();
        snprintf(string_buffer, sizeof(string_buffer), "%s", message);
        *fault = 1;
    } COFFEE_END();
}

crash when *fault is 0
logcat is:
--------- beginning of crash 10-09 14:45:45.711 6975-6975/? A/libc: Fatal signal 8 (SIGFPE), code -6, fault addr 0x1b3f in tid 6975 (xample.hellojni)

My Phone is Nexus 5 Android 5.1.1