]> git.saurik.com Git - redis.git/commitdiff
added support to dump registers on crash on Linux x64
authorantirez <antirez@gmail.com>
Fri, 20 Jan 2012 11:54:15 +0000 (12:54 +0100)
committerantirez <antirez@gmail.com>
Fri, 20 Jan 2012 11:54:15 +0000 (12:54 +0100)
src/debug.c
src/redis.h

index 59e15844ca7cf7fbecfd3e03132a75a4aeca5079..bddb082e527f3c10a6f6a135875a81495edf1623 100644 (file)
@@ -498,7 +498,34 @@ void logRegisters(ucontext_t *uc) {
 #elif defined(__i386__)
     return (void*) uc->uc_mcontext.gregs[14]; /* Linux 32 */
 #elif defined(__X86_64__) || defined(__x86_64__)
 #elif defined(__i386__)
     return (void*) uc->uc_mcontext.gregs[14]; /* Linux 32 */
 #elif defined(__X86_64__) || defined(__x86_64__)
-    return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */
+    redisLog(REDIS_WARNING,
+    "\n"
+    "RAX:%p RBX:%p RCX:%p RDX:%p\n"
+    "RDI:%p RSI:%p RBP:%p RSP:%p\n"
+    "R8:%p  R9:%p  R10:%p R11:%p\n"
+    "R12:%p R13:%p R14:%p R15:%p\n"
+    "RIP:%p EFL:%p CSGSFS:%p",
+        uc->uc_mcontext.gregs[13],
+        uc->uc_mcontext.gregs[11],
+        uc->uc_mcontext.gregs[14],
+        uc->uc_mcontext.gregs[12],
+        uc->uc_mcontext.gregs[8],
+        uc->uc_mcontext.gregs[9],
+        uc->uc_mcontext.gregs[10],
+        uc->uc_mcontext.gregs[15],
+        uc->uc_mcontext.gregs[0],
+        uc->uc_mcontext.gregs[1],
+        uc->uc_mcontext.gregs[2],
+        uc->uc_mcontext.gregs[3],
+        uc->uc_mcontext.gregs[4],
+        uc->uc_mcontext.gregs[5],
+        uc->uc_mcontext.gregs[6],
+        uc->uc_mcontext.gregs[7],
+        uc->uc_mcontext.gregs[16],
+        uc->uc_mcontext.gregs[17],
+        uc->uc_mcontext.gregs[18]
+    );
+    logStackContent((void**)uc->uc_mcontext.gregs[15]);
 #else
     redisLog(REDIS_WARNING,
         "  Dumping of registers not supported for this OS/arch");
 #else
     redisLog(REDIS_WARNING,
         "  Dumping of registers not supported for this OS/arch");
index 37f0b2ab8fc18b547fe0a0b3e6f3b8516c3f4f9c..8889779a4f144e4a62fc02265566b2475a8a3c77 100644 (file)
@@ -20,6 +20,7 @@
 #include <syslog.h>
 #include <netinet/in.h>
 #include <lua.h>
 #include <syslog.h>
 #include <netinet/in.h>
 #include <lua.h>
+#include <signal.h>
 
 #include "ae.h"      /* Event driven programming library */
 #include "sds.h"     /* Dynamic safe strings */
 
 #include "ae.h"      /* Event driven programming library */
 #include "sds.h"     /* Dynamic safe strings */