coffeecatch icon indicating copy to clipboard operation
coffeecatch copied to clipboard

SIGSEGV in coffeecatch_native_code_handler_struct_free

Open Propheta13 opened this issue 8 years ago • 1 comments

Hi. I am trying to do some little testing of coffeecatch without JNI - in pure C/C++ on Android 4.4.4 x86. Doing something like this:

test_result_t run_test(int signal) {
    test_result_t result = {false, 0};
    COFFEE_TRY() {
        raise(signal);
    } COFFEE_CATCH() {
        coffeecatch_cancel_pending_alarm();
        result.catched_signal = coffeecatch_get_signal();
    } COFFEE_END();
    result.exited = true;
    return result;
}

int main(int argc, char** argv) {
    test_result_t result = run_test(SIGFPE);
    LOG("SIGFPE CATCH TEST: ");

    ASSERT_TRUE(SIGFPE == result.catched_signal && true == result.exited);
}

Unfortunately i am getting SEGFAULT during COFFEE_END(). Logcat and coffeecatch debug logs attached.

debug.txt logcat.txt

Propheta13 avatar Mar 18 '16 10:03 Propheta13

Please notice that code without changes was giving me a lot of redeclaration errors: Error:(122, 8) error: redefinition of 'struct _libc_fpreg' Error:(128, 8) error: redefinition of 'struct _libc_fpstate' Error:(140, 19) error: conflicting types for 'greg_t' Error:(147, 3) error: conflicting types for 'mcontext_t' Error:(150, 3) error: redeclaration of enumerator 'REG_GS' Error:(151, 3) error: redeclaration of enumerator 'REG_FS' Error:(152, 3) error: redeclaration of enumerator 'REG_ES' Error:(153, 3) error: redeclaration of enumerator 'REG_DS' Error:(154, 3) error: redeclaration of enumerator 'REG_EDI' Error:(155, 3) error: redeclaration of enumerator 'REG_ESI' Error:(156, 3) error: redeclaration of enumerator 'REG_EBP' Error:(157, 3) error: redeclaration of enumerator 'REG_ESP' Error:(158, 3) error: redeclaration of enumerator 'REG_EBX' Error:(159, 3) error: redeclaration of enumerator 'REG_EDX' Error:(160, 3) error: redeclaration of enumerator 'REG_ECX' Error:(161, 3) error: redeclaration of enumerator 'REG_EAX' Error:(162, 3) error: redeclaration of enumerator 'REG_TRAPNO' Error:(163, 3) error: redeclaration of enumerator 'REG_ERR' Error:(164, 3) error: redeclaration of enumerator 'REG_EIP' Error:(165, 3) error: redeclaration of enumerator 'REG_CS' Error:(166, 3) error: redeclaration of enumerator 'REG_EFL' Error:(167, 3) error: redeclaration of enumerator 'REG_UESP' Error:(168, 3) error: redeclaration of enumerator 'REG_SS'

So i moved #if !defined(*BIONIC_HAVE_UCONTEXT_T) to line before /* Taken from Google Breakpad. / just after #elif defined(__i386).

Propheta13 avatar Mar 22 '16 10:03 Propheta13