// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r14
movl %edi, %ebx
callq 0x4984f
leaq 0x47730(%rip), %rsi     # 0x917db
leaq 0x428c8(%rip), %rdx     # 0x8c97a
pushq $0x3
popq %rbp
movl %ebp, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x22613
leaq 0x7cee1(%rip), %r13     # 0xc6fa8
movq 0x820(%r13), %rdx
movq 0x828(%r13), %rcx
movl 0x830(%r13), %r8d
leaq 0x4771b(%rip), %rsi     # 0x917fe
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
leaq 0x4772c(%rip), %rsi     # 0x9181f
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
movq %r14, %rdi
callq 0x49c5f
leaq 0x47724(%rip), %rsi     # 0x9182f
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
leaq 0x4d39f(%rip), %rdi     # 0x974ba
callq 0x25a0f
movq %rax, %r15
callq 0x21635
leaq 0x47710(%rip), %rsi     # 0x9183f
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2763d
movq %rax, %r15
movl %ebp, %edi
movq %rax, %rsi
callq 0x224d3
leaq 0x47705(%rip), %rsi     # 0x91854
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
callq 0x2da10
movq %rax, %r12
movl %ebp, %edi
movq %rax, %rsi
callq 0x224d3
movq %r15, %rdi
callq 0x271f7
movq %r12, %rdi
callq 0x271f7
callq 0x49ce0
movq %r14, %rdi
callq 0x49b34
leaq 0x476dd(%rip), %rsi     # 0x9186b
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
callq 0x54166
callq 0x49de6
testl %eax, %eax
leaq 0x4770c(%rip), %rax     # 0x918b6
leaq 0x476cf(%rip), %rsi     # 0x91880
cmoveq %rax, %rsi
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
leaq 0x4776b(%rip), %rsi     # 0x91930
movl %ebp, %edi
xorl %eax, %eax
callq 0x22613
cmpl $0x0, 0x484(%r13)
je 0x4a1e1
movq 0x48(%r13), %rdi
callq 0x1f3a0
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x1fa40
movl $0xc8000000, 0x80(%r14) # imm = 0xC8000000
andq $0x0, -0x8(%r14)
movq %rsp, %rsi
movl %ebx, %edi
xorl %edx, %edx
callq 0x1f670
callq 0x1f410
movl %eax, %edi
movl %ebx, %esi
callq 0x1f620
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq