0

I'm using google breakpad to catch incorrect operations which lead SIGSEGV signal. I expect the process to continue but it's finished by dalvik jvm in android. How can i recovery the process from finishing on android?

4ntoine
  • 19,816
  • 21
  • 96
  • 220

1 Answers1

1

Have you tried this?

#include <signal.h>
#include <stdio.h>
#define __USE_GNU
#include <ucontext.h>

int *p = NULL;
int n = 100;

void sighandler(int signo, siginfo_t *si, ucontext_t* context)
{
    printf("Handler executed for signal %d\n", signo);
    context->uc_mcontext.gregs[REG_RAX] = &n;
}

_your_amazing_method (jenv *env, jobject obj, _your_args)
{
    do_some_dirty_stuff();
    signal(SIGSEGV, sighandler);
    printf("%d\n", *p); // ... movl (%rax), %esi ...
    return 0;
}
Community
  • 1
  • 1
Cedmundo
  • 682
  • 4
  • 12