SIGSEGV: how map the error line and get an exception from a segfault
Budjetti $30-250 USD
- Freelancer
- Työtehtävät
- C++ -ohjelmointi
- SIGSEGV: how map the error line and get an exception from a segfault
I would like to know how to find the class and the location where the error occurred using C++ in ndk.
I would also like to know how to keep the program running even after a segfault.
I have this function that displays the error, I don't know how to read it or what each thing means
void handler(int signum, siginfo_t *info, void* contextPtr)
{
ucontext* context = (ucontext_t*)contextPtr;
if(info->si_signo == SIGSEGV)
{
Log("SIGSEGV | Fault address: 0x%X", info->si_addr);
Log("libGTASA base address: 0x%X", g_libGTASA);
Log("register states:");
Log("r0: 0x%X, r1: 0x%X, r2: 0x%X, r3: 0x%X",
context->uc_mcontext.arm_r0,
context->uc_mcontext.arm_r1,
context->uc_mcontext.arm_r2,
context->uc_mcontext.arm_r3);
Log("r4: 0x%x, r5: 0x%x, r6: 0x%x, r7: 0x%x",
context->uc_mcontext.arm_r4,
context->uc_mcontext.arm_r5,
context->uc_mcontext.arm_r6,
context->uc_mcontext.arm_r7);
Log("r8: 0x%x, r9: 0x%x, sl: 0x%x, fp: 0x%x",
context->uc_mcontext.arm_r8,
context->uc_mcontext.arm_r9,
context->uc_mcontext.arm_r10,
context->uc_mcontext.arm_fp);
Log("ip: 0x%x, sp: 0x%x, lr: 0x%x, pc: 0x%x",
context->uc_mcontext.arm_ip,
context->uc_mcontext.arm_sp,
context->uc_mcontext.arm_lr,
context->uc_mcontext.arm_pc);
Log("backtrace:");
Log("1: [login to view URL] + 0x%X", context->uc_mcontext.arm_pc - g_libGTASA);
Log("2: [login to view URL] + 0x%X", context->uc_mcontext.arm_lr - g_libGTASA);
Log("1: [login to view URL] + 0x%X", context->uc_mcontext.arm_pc - FindLibrary("[login to view URL]"));
Log("2: [login to view URL] + 0x%X", context->uc_mcontext.arm_lr - FindLibrary("[login to view URL]"));
exit(0);
}
return;
}