Käynnissä

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;

}

Taidot: C++ -ohjelmointi, Android

Näytä lisää: how to debug segmentation fault in c, sigsegv, segmentation fault, segmentation fault python, segmentation fault linux, segmentation fault 11 c++, sigsegv handler, segmentation fault in c, how to debug segmentation fault in linux, page error line char object doesnt support property, stack error line, fix error line object expected, script error line 105, repair error line mysql line 330, world map animation line, rss error line wordpress, phpbb3 mass email error line 416, map usa line simple, warning chmod functionchmod error line 131, parse error syntax error line, parse error line joomla

Tietoa työnantajasta:
( 1 arvostelu ) Chapecó, Brazil

Projektin tunnus: #25746586