// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x64910
movl -0x4(%rbp), %ecx
movl $0x3, %edi
leaq 0x800d1(%rip), %rsi     # 0xe5873
leaq 0x7b23f(%rip), %rdx     # 0xe09e8
movb $0x0, %al
callq 0x24fb0
leaq 0xae141(%rip), %rax     # 0x1138f8
movq 0x820(%rax), %rdx
leaq 0xae133(%rip), %rax     # 0x1138f8
movq 0x828(%rax), %rcx
leaq 0xae125(%rip), %rax     # 0x1138f8
movl 0x830(%rax), %r8d
movl $0x3, %edi
leaq 0x800b0(%rip), %rsi     # 0xe5896
movb $0x0, %al
callq 0x24fb0
movl $0x3, %edi
leaq 0x800be(%rip), %rsi     # 0xe58b7
movb $0x0, %al
callq 0x24fb0
movq -0x20(%rbp), %rdi
callq 0x64f70
movl $0x3, %edi
leaq 0x800b2(%rip), %rsi     # 0xe58c7
movb $0x0, %al
callq 0x24fb0
leaq 0x85e77(%rip), %rdi     # 0xeb69a
callq 0x29db0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xd0(%rbp)
callq 0x23020
movq -0xd0(%rbp), %rdi
movl %eax, %edx
leaq 0x8008b(%rip), %rsi     # 0xe58d7
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
movl $0x3, %edi
callq 0x24dd0
movl $0x3, %edi
leaq 0x8007b(%rip), %rsi     # 0xe58ec
movb $0x0, %al
callq 0x24fb0
callq 0x383c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
movl $0x3, %edi
callq 0x24dd0
movq -0x28(%rbp), %rdi
callq 0x2c160
movq -0x30(%rbp), %rdi
callq 0x2c160
callq 0x65090
movq -0x20(%rbp), %rdi
callq 0x64dd0
movl $0x3, %edi
leaq 0x80048(%rip), %rsi     # 0xe5903
movb $0x0, %al
callq 0x24fb0
callq 0x75c80
callq 0x651f0
cmpl $0x0, %eax
je 0x658e6
movl $0x3, %edi
leaq 0x8003b(%rip), %rsi     # 0xe5918
movb $0x0, %al
callq 0x24fb0
jmp 0x658f9
movl $0x3, %edi
leaq 0x8005c(%rip), %rsi     # 0xe594e
movb $0x0, %al
callq 0x24fb0
movl $0x3, %edi
leaq 0x800c3(%rip), %rsi     # 0xe59c8
movb $0x0, %al
callq 0x24fb0
leaq 0xadfe5(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x484(%rax)
je 0x6592c
leaq 0xadfd5(%rip), %rax     # 0x1138f8
movq 0x48(%rax), %rdi
callq 0x1f3a0
leaq -0xc8(%rbp), %rdi
addq $0x8, %rdi
callq 0x1fa50
movl $0xc8000000, -0x40(%rbp) # imm = 0xC8000000
movq $0x0, -0xc8(%rbp)
movl -0x4(%rbp), %edi
leaq -0xc8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x1f670
callq 0x1f410
movl %eax, %edi
movl -0x4(%rbp), %esi
callq 0x1f620
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)