// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/debug.c
// Function: sigsegvHandler
void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
    ucontext_t *uc = (ucontext_t*) secret;
    sds infostring, clients;
    struct sigaction act;
    REDIS_NOTUSED(info);

    bugReportStart();
    redisLog(REDIS_WARNING,
        "    Redis %s crashed by signal: %d", REDIS_VERSION, sig);
    redisLog(REDIS_WARNING,
        "    Failed assertion: %s (%s:%d)", server.assert_failed,
                        server.assert_file, server.assert_line);

    /* Log the stack trace */
    redisLog(REDIS_WARNING, "--- STACK TRACE");
    logStackTrace(uc);

    /* Log INFO and CLIENT LIST */
    redisLog(REDIS_WARNING, "--- INFO OUTPUT");
    infostring = genRedisInfoString("all");
    infostring = sdscatprintf(infostring, "hash_init_value: %u\n",
        dictGetHashFunctionSeed());
    redisLogRaw(REDIS_WARNING, infostring);
    redisLog(REDIS_WARNING, "--- CLIENT LIST OUTPUT");
    clients = getAllClientsInfoString();
    redisLogRaw(REDIS_WARNING, clients);
    sdsfree(infostring);
    sdsfree(clients);

    /* Log the current client */
    logCurrentClient();

    /* Log dump of processor registers */
    logRegisters(uc);

#if defined(HAVE_PROC_MAPS)
    /* Test memory */
    redisLog(REDIS_WARNING, "--- FAST MEMORY TEST");
    bioKillThreads();
    if (memtest_test_linux_anonymous_maps()) {
        redisLog(REDIS_WARNING,
            "!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!");
    } else {
        redisLog(REDIS_WARNING,
            "Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.");
    }
#endif

    redisLog(REDIS_WARNING,
"\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n"
"       Please report the crash opening an issue on github:\n\n"
"           http://github.com/antirez/redis/issues\n\n"
"  Suspect RAM error? Use redis-server --test-memory to veryfy it.\n\n"
);
    /* free(messages); Don't call free() with possibly corrupted memory. */
    if (server.daemonize) unlink(server.pidfile);

    /* Make sure we exit with the right signal at the end. So for instance
     * the core will be dumped if enabled. */
    sigemptyset (&act.sa_mask);
    act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND;
    act.sa_handler = SIG_DFL;
    sigaction (sig, &act, NULL);
    kill(getpid(),sig);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movl %edi, %ebx
leaq 0x7c381(%rip), %r13     # 0xc9fa8
cmpl $0x0, 0x834(%r13)
jne 0x4dc4f
leaq 0x4da11(%rip), %rsi     # 0x9b649
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
movl $0x1, 0x834(%r13)
leaq 0x4dbc5(%rip), %rsi     # 0x9b81b
leaq 0x48d5d(%rip), %rdx     # 0x969ba
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x23223
movq 0x820(%r13), %rdx
movq 0x828(%r13), %rcx
movl 0x830(%r13), %r8d
leaq 0x4dbb7(%rip), %rsi     # 0x9b83e
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
leaq 0x4dbc5(%rip), %rsi     # 0x9b85f
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
movq %r14, %rdi
callq 0x4d754
leaq 0x4dbba(%rip), %rsi     # 0x9b86f
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
leaq 0x53862(%rip), %rdi     # 0xa152a
callq 0x26b5d
movq %rax, %r15
callq 0x220b5
leaq 0x4dba3(%rip), %rsi     # 0x9b87f
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x28a5e
movq %rax, %r15
movl $0x3, %edi
movq %rax, %rsi
callq 0x230d4
leaq 0x4db95(%rip), %rsi     # 0x9b894
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
callq 0x2f513
movq %rax, %r12
movl $0x3, %edi
movq %rax, %rsi
callq 0x230d4
movq %r15, %rdi
callq 0x2850d
movq %r12, %rdi
callq 0x2850d
callq 0x4d7d9
movq %r14, %rdi
callq 0x4d602
leaq 0x4db67(%rip), %rsi     # 0x9b8ab
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
callq 0x587f3
callq 0x4d8f5
testl %eax, %eax
leaq 0x4db93(%rip), %rax     # 0x9b8f6
leaq 0x4db56(%rip), %rsi     # 0x9b8c0
cmoveq %rax, %rsi
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
leaq 0x4dbef(%rip), %rsi     # 0x9b970
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
cmpl $0x0, 0x484(%r13)
je 0x4dda0
movq 0x48(%r13), %rdi
callq 0x1f3a0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1fa40
movl $0xc8000000, 0x80(%r14) # imm = 0xC8000000
movq $0x0, -0x8(%r14)
leaq 0x8(%rsp), %rsi
movl %ebx, %edi
xorl %edx, %edx
callq 0x1f670
callq 0x1f410
movl %eax, %edi
movl %ebx, %esi
callq 0x1f620
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq