MCPcopy Create free account
hub / github.com/F-Stack/f-stack / logRegisters

Function logRegisters

app/redis-6.2.6/src/debug.c:1096–1519  ·  view source on GitHub ↗

Log dump of processor registers */

Source from the content-addressed store, hash-verified

1094
1095/* Log dump of processor registers */
1096void logRegisters(ucontext_t *uc) {
1097 serverLog(LL_WARNING|LL_RAW, "\n------ REGISTERS ------\n");
1098
1099/* OSX */
1100#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
1101 /* OSX AMD64 */
1102 #if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
1103 serverLog(LL_WARNING,
1104 "\n"
1105 "RAX:%016lx RBX:%016lx\nRCX:%016lx RDX:%016lx\n"
1106 "RDI:%016lx RSI:%016lx\nRBP:%016lx RSP:%016lx\n"
1107 "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n"
1108 "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n"
1109 "RIP:%016lx EFL:%016lx\nCS :%016lx FS:%016lx GS:%016lx",
1110 (unsigned long) uc->uc_mcontext->__ss.__rax,
1111 (unsigned long) uc->uc_mcontext->__ss.__rbx,
1112 (unsigned long) uc->uc_mcontext->__ss.__rcx,
1113 (unsigned long) uc->uc_mcontext->__ss.__rdx,
1114 (unsigned long) uc->uc_mcontext->__ss.__rdi,
1115 (unsigned long) uc->uc_mcontext->__ss.__rsi,
1116 (unsigned long) uc->uc_mcontext->__ss.__rbp,
1117 (unsigned long) uc->uc_mcontext->__ss.__rsp,
1118 (unsigned long) uc->uc_mcontext->__ss.__r8,
1119 (unsigned long) uc->uc_mcontext->__ss.__r9,
1120 (unsigned long) uc->uc_mcontext->__ss.__r10,
1121 (unsigned long) uc->uc_mcontext->__ss.__r11,
1122 (unsigned long) uc->uc_mcontext->__ss.__r12,
1123 (unsigned long) uc->uc_mcontext->__ss.__r13,
1124 (unsigned long) uc->uc_mcontext->__ss.__r14,
1125 (unsigned long) uc->uc_mcontext->__ss.__r15,
1126 (unsigned long) uc->uc_mcontext->__ss.__rip,
1127 (unsigned long) uc->uc_mcontext->__ss.__rflags,
1128 (unsigned long) uc->uc_mcontext->__ss.__cs,
1129 (unsigned long) uc->uc_mcontext->__ss.__fs,
1130 (unsigned long) uc->uc_mcontext->__ss.__gs
1131 );
1132 logStackContent((void**)uc->uc_mcontext->__ss.__rsp);
1133 #elif defined(__i386__)
1134 /* OSX x86 */
1135 serverLog(LL_WARNING,
1136 "\n"
1137 "EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n"
1138 "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n"
1139 "SS:%08lx EFL:%08lx EIP:%08lx CS :%08lx\n"
1140 "DS:%08lx ES:%08lx FS :%08lx GS :%08lx",
1141 (unsigned long) uc->uc_mcontext->__ss.__eax,
1142 (unsigned long) uc->uc_mcontext->__ss.__ebx,
1143 (unsigned long) uc->uc_mcontext->__ss.__ecx,
1144 (unsigned long) uc->uc_mcontext->__ss.__edx,
1145 (unsigned long) uc->uc_mcontext->__ss.__edi,
1146 (unsigned long) uc->uc_mcontext->__ss.__esi,
1147 (unsigned long) uc->uc_mcontext->__ss.__ebp,
1148 (unsigned long) uc->uc_mcontext->__ss.__esp,
1149 (unsigned long) uc->uc_mcontext->__ss.__ss,
1150 (unsigned long) uc->uc_mcontext->__ss.__eflags,
1151 (unsigned long) uc->uc_mcontext->__ss.__eip,
1152 (unsigned long) uc->uc_mcontext->__ss.__cs,
1153 (unsigned long) uc->uc_mcontext->__ss.__ds,

Callers 1

sigsegvHandlerFunction · 0.85

Calls 1

logStackContentFunction · 0.85

Tested by

no test coverage detected