From acc8aa6f0502a63770574010f4ac6ee655a06e7c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 26 Jan 2003 16:47:16 +0000 Subject: [PATCH] New function NTFS_BUG() which prints an error message and then causes a segmentation fault. Only to be used for critical bug catches... (Logical change 1.111) --- include/debug.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/include/debug.h b/include/debug.h index a5716196..440d2112 100644 --- a/include/debug.h +++ b/include/debug.h @@ -22,15 +22,16 @@ #ifndef _NTFS_DEBUG_H #define _NTFS_DEBUG_H -#include "attrib.h" - -#ifdef DEBUG - #include "config.h" #ifdef HAVE_STDIO_H # include #endif + +#include "attrib.h" + +#ifdef DEBUG + #ifdef HAVE_STDARG_H # include #endif @@ -65,14 +66,22 @@ static __inline__ void Dperror(const char *s) extern void ntfs_debug_runlist_dump(const runlist_element *rl); -#else +#else /* if !DEBUG */ static __inline__ void Dprintf(const char *fmt, ...) {} static __inline__ void Dputs(const char *s) {} static __inline__ void Dperror(const char *s) {} static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl) {} -#endif +#endif /* !DEBUG */ + +#define NTFS_BUG(msg) \ +{ \ + int ___i; \ + fprintf(stderr, "libntfs: Bug in %s(): %s\n", __FUNCTION__, msg); \ + Dputs("Forcing segmentation fault!"); \ + ___i = ((int*)NULL)[1]; \ +} #endif /* defined _NTFS_DEBUG_H */