]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Dumping NGREG in traphandler only if it is supported by the platform.
authorBernhard Froehlich <decke@bluelife.at>
Sat, 4 May 2013 12:57:29 +0000 (14:57 +0200)
committerBernhard Froehlich <decke@bluelife.at>
Sat, 4 May 2013 12:57:29 +0000 (14:57 +0200)
src/trap.c

index b0fe543bea1e59cb6174c01c0babe0c36bf83ea8..7a731d30a85c3255a79a6ecadeb0c92ee4b4d422 100644 (file)
@@ -134,14 +134,18 @@ add2lineresolve(const char *binary, void *addr, char *buf0, size_t buflen)
 static void 
 traphandler(int sig, siginfo_t *si, void *UC)
 {
+#ifdef NGREG
   ucontext_t *uc = UC;
+#endif
 #if ENABLE_EXECINFO
   char buf[200];
   static void *frames[MAXFRAMES];
   int nframes = backtrace(frames, MAXFRAMES);
   Dl_info dli;
 #endif
+#if defined(NGREG) || defined(ENABLE_EXECINFO)
   int i;
+#endif
   const char *reason = NULL;
 
   tvhlog_spawn(LOG_ALERT, "CRASH", "Signal: %d in %s ", sig, line1);
@@ -165,6 +169,7 @@ traphandler(int sig, siginfo_t *si, void *UC)
               si->si_addr, reason ?: "N/A");
 
   tvhlog_spawn(LOG_ALERT, "CRASH", "Loaded libraries: %s ", libs);
+#ifdef NGREG
   snprintf(tmpbuf, sizeof(tmpbuf), "Register dump [%d]: ", NGREG);
 
   for(i = 0; i < NGREG; i++) {
@@ -174,6 +179,7 @@ traphandler(int sig, siginfo_t *si, void *UC)
     sappend(tmpbuf, sizeof(tmpbuf), "%08x ", uc->uc_mcontext.gregs[i]);
 #endif
   }
+#endif
   tvhlog_spawn(LOG_ALERT, "CRASH", "%s", tmpbuf);
 
 #if ENABLE_EXECINFO