[Initng-svn] r3708 - in initng/trunk: . src
svn at initng.thinktux.net
svn at initng.thinktux.net
Thu Apr 6 15:59:39 CEST 2006
Author: makomk
Date: Thu Apr 6 15:59:37 2006
New Revision: 3708
Modified:
initng/trunk/CMakeLists.txt
initng/trunk/src/CMakeLists.txt
initng/trunk/src/initng_main.c
Log:
Support for Google Coredumper (requires it to be installed somewhere accessible at boot time, only enabled with
CMake debug builds, TODO: use static library)
Modified: initng/trunk/CMakeLists.txt
==============================================================================
--- initng/trunk/CMakeLists.txt (original)
+++ initng/trunk/CMakeLists.txt Thu Apr 6 15:59:37 2006
@@ -75,7 +75,12 @@
OPTION(INSTALL_AS_INIT "Install initng as replacement for sysvinit" OFF)
OPTION(DEBUG "Build with developer tools, turns on additional warnings and Werror" ON)
+
+
IF(DEBUG)
+ CHECK_INCLUDE_FILES(google/coredumper.h HAVE_COREDUMPER_H)
+ CHECK_LIBRARY_EXISTS(coredumper WriteCoreDump "" HAVE_COREDUMPER)
+
ADD_DEFINITIONS(-DDEBUG -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wimplicit -Wredundant-decls -Wnested-externs -Wwrite-strings -Wsign-compare -Winline -Wswitch -Wreturn-type -Wparentheses -Wmissing-braces -Wformat -Wformat-nonliteral -Wformat-security -Wsequence-point -Wundef -Wunused -Wcomment)
ENDIF(DEBUG)
Modified: initng/trunk/src/CMakeLists.txt
==============================================================================
--- initng/trunk/src/CMakeLists.txt (original)
+++ initng/trunk/src/CMakeLists.txt Thu Apr 6 15:59:37 2006
@@ -36,8 +36,14 @@
initng_global.c
)
+SET(initng_extralibs)
+
+IF(DEBUG AND HAVE_COREDUMPER)
+SET(initng_extralibs coredumper)
+ENDIF(DEBUG AND HAVE_COREDUMPER)
+
ADD_LIBRARY(initng SHARED ${initng_lib_srcs})
-TARGET_LINK_LIBRARIES(initng dl)
+TARGET_LINK_LIBRARIES(initng dl ${initng_extralibs})
SET_TARGET_PROPERTIES(initng PROPERTIES VERSION 0.0.0 SOVERSION 0)
INSTALL_TARGETS(/lib initng)
Modified: initng/trunk/src/initng_main.c
==============================================================================
--- initng/trunk/src/initng_main.c (original)
+++ initng/trunk/src/initng_main.c Thu Apr 6 15:59:37 2006
@@ -45,6 +45,9 @@
#include "initng_load_module.h"
#include "initng_plugin_callers.h"
#include "initng_toolbox.h"
+#if defined(DEBUG) && defined(HAVE_COREDUMPER) && defined(HAVE_COREDUMPER_H)
+#include <google/coredumper.h>
+#endif
#include "initng_main.h"
@@ -429,6 +432,19 @@
#ifdef DEBUG
#define MESSAGE "Initng segfaulted, will wait in 20 seconds for you to start a gdb, before execve(/sbin/initng-segfault);\n"
+#if defined(HAVE_COREDUMPER) && defined(HAVE_COREDUMPER_H)
+ {
+ char buf[50];
+
+ sprintf(buf, "/dev/shm/initng-core-%i-%i", getpid(),
+ (int) time(NULL));
+ if (WriteCoreDump(buf) == 0)
+ {
+ printf("Dumped core to %s\n", buf);
+ }
+ }
+#endif
+
/* Try to launch a getty, that we may if lucky login to tty9 and run gdb there */
if (fork() == 0)
{
More information about the Initng-svn
mailing list