[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/icecream-make-it-cool/services
From:       Dirk Mueller <mueller () kde ! org>
Date:       2008-02-09 12:11:41
Message-ID: 1202559101.389437.21688.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 772685 by mueller:

add a segfault catcher


 M  +1 -1      Makefile.am  
 M  +18 -0     logging.cpp  


--- branches/work/icecream-make-it-cool/services/Makefile.am #772684:772685
@@ -3,7 +3,7 @@
 lib_LTLIBRARIES = libicecc.la
 
 libicecc_la_SOURCES = job.cpp comm.cpp getifaddrs.cpp logging.cpp tempfile.c platform.cpp
-libicecc_la_LIBADD = ../minilzo/libminilzo.la
+libicecc_la_LIBADD = ../minilzo/libminilzo.la -ldl
 libicecc_la_CFLAGS = -fPIC -DPIC
 libicecc_la_CXXFLAGS = -fPIC -DPIC
 
--- branches/work/icecream-make-it-cool/services/logging.cpp #772684:772685
@@ -23,6 +23,9 @@
 #include "logging.h"
 #include <fstream>
 #include <signal.h>
+#ifdef __linux__
+#include <dlfcn.h>
+#endif
 
 using namespace std;
 
@@ -41,6 +44,7 @@
 
 void setup_debug(int level, const string &filename, const string& prefix)
 {
+    string fname = filename;
     debug_level = level;
     logfile_prefix = prefix;
     logfile_filename = filename;
@@ -51,10 +55,24 @@
     if ( filename.length() ) {
 	logfile_file.clear();
         logfile_file.open( filename.c_str(), fstream::out | fstream::app );
+#ifdef __linux__
+        if (fname[0] != '/') {
+            char buf[256];
+            if (getcwd(buf, sizeof(buf))) {
+                fname.insert(0, "/");
+                fname.insert(0, buf);
+            }
+        }
+        setenv("SEGFAULT_OUTPUT_NAME", fname.c_str(), false);
+#endif
         output = &logfile_file;
     } else
         output = &cerr;
 
+#ifdef __linux__
+    (void) dlopen("libSegFault.so", RTLD_NOW | RTLD_LOCAL);
+#endif
+
     if ( debug_level & Debug )
         logfile_trace = output;
     else
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic