aboutsummaryrefslogtreecommitdiff
path: root/src/espik_debug.c
diff options
context:
space:
mode:
authorbeber <beber>2005-12-01 19:11:50 +0000
committerbeber <beber>2005-12-01 19:11:50 +0000
commit93309052cf55b2b5023dda59ec5c9aab40fa601d (patch)
tree3977a2aaebbd2b5410a2f3f8916c22625474ca21 /src/espik_debug.c
parenttest are finished (diff)
downloadespik-93309052cf55b2b5023dda59ec5c9aab40fa601d.tar.xz
Make debug compil
Diffstat (limited to 'src/espik_debug.c')
-rw-r--r--src/espik_debug.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/espik_debug.c b/src/espik_debug.c
index 9f4a121..601ef7c 100644
--- a/src/espik_debug.c
+++ b/src/espik_debug.c
@@ -1,15 +1,17 @@
-#if _ESPIK_DEBUG
+#include "espik_debug.h"
#ifdef __GLIBC__
-#include <execinfo.h>
-#endif
+# include <execinfo.h>
+#endif /* __GLIBC__ */
-#include <stdio.h>
-#include <signal.h>
+#if _ESPIK_DEBUG
+# include <stdio.h>
+# include <signal.h>
+#endif /* _ESPIK_DEBUG */
inline void espik_debug_bt (int num)
{
-#ifdef __GLIBC__
+#ifdef __GLIBC__ && _ESPIK_DEBUG
void *array[128];
size_t size;
char **strings;
@@ -26,18 +28,20 @@ inline void espik_debug_bt (int num)
if (strings)
free(strings);
#else
+# ifdef __GLIBC__
fprintf(stderr, "Your system doesn't have glibc. Backtraces disabled. But program receive signal %d.\n", num);
-#endif /* __GLIBC__ */
+# endif /* __GLIBC__ */
+#endif /* __GLIBC__ && _ESPIK_DEBUG */
}
void espik_debug_init()
{
+#if _ESPIK_DEBUG
struct sigaction sa;
sa.sa_handler = espik_debug_bt;
sigaction(SIGSEGV, &sa, (struct sigaction *)0);
sigaction(SIGINT, &sa, (struct sigaction *)0);
sigaction(SIGKILL, &sa, (struct sigaction *)0);
+#endif
}
-
-#endif /* _ESPIK_DEBUG */