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

Function sigsegvHandler

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

Source from the content-addressed store, hash-verified

1801}
1802
1803void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
1804 UNUSED(secret);
1805 UNUSED(info);
1806
1807 bugReportStart();
1808 serverLog(LL_WARNING,
1809 "Redis %s crashed by signal: %d, si_code: %d", REDIS_VERSION, sig, info->si_code);
1810 if (sig == SIGSEGV || sig == SIGBUS) {
1811 serverLog(LL_WARNING,
1812 "Accessing address: %p", (void*)info->si_addr);
1813 }
1814 if (info->si_code <= SI_USER && info->si_pid != -1) {
1815 serverLog(LL_WARNING, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid);
1816 }
1817
1818#ifdef HAVE_BACKTRACE
1819 ucontext_t *uc = (ucontext_t*) secret;
1820 void *eip = getMcontextEip(uc);
1821 if (eip != NULL) {
1822 serverLog(LL_WARNING,
1823 "Crashed running the instruction at: %p", eip);
1824 }
1825
1826 logStackTrace(getMcontextEip(uc), 1);
1827
1828 logRegisters(uc);
1829#endif
1830
1831 printCrashReport();
1832
1833#ifdef HAVE_BACKTRACE
1834 if (eip != NULL)
1835 dumpCodeAroundEIP(eip);
1836#endif
1837
1838 bugReportEnd(1, sig);
1839}
1840
1841void printCrashReport(void) {
1842 /* Log INFO and CLIENT LIST */

Callers

nothing calls this directly

Calls 7

bugReportStartFunction · 0.85
getMcontextEipFunction · 0.85
logStackTraceFunction · 0.85
logRegistersFunction · 0.85
printCrashReportFunction · 0.85
dumpCodeAroundEIPFunction · 0.85
bugReportEndFunction · 0.85

Tested by

no test coverage detected