re-enable kernel asserts.

Disabled by default, but all kernel devs are *highly* recommended to turn them on for your builds and see if it trips anything, and then fix it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21477 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Travis Geiselbrecht
2007-06-21 05:37:46 +00:00
parent 554fdaa33a
commit c9788912f0
3 changed files with 24 additions and 10 deletions
+17 -6
View File
@@ -11,23 +11,34 @@
#include <OS.h> #include <OS.h>
struct kernel_args; //#define DEBUG 1
#if DEBUG #if DEBUG
# define ASSERT(x) \ /*
if (x) {} else { panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); } * The kernel debug level.
* Level 1 is usual asserts, > 1 should be used for very expensive runtime checks
*/
#define KDEBUG 1
#endif
#define ASSERT_ALWAYS(x) \
do { if (!(x)) { panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); } } while (0)
#if KDEBUG
#define ASSERT(x) ASSERT_ALWAYS(x)
#else #else
# define ASSERT(x) #define ASSERT(x) \
do { } while(0)
#endif #endif
extern int dbg_register_file[B_MAX_CPU_COUNT][14]; extern int dbg_register_file[B_MAX_CPU_COUNT][14];
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct kernel_args;
extern status_t debug_init(struct kernel_args *args); extern status_t debug_init(struct kernel_args *args);
extern status_t debug_init_post_vm(struct kernel_args *args); extern status_t debug_init_post_vm(struct kernel_args *args);
extern status_t debug_init_post_modules(struct kernel_args *args); extern status_t debug_init_post_modules(struct kernel_args *args);
+5 -2
View File
@@ -39,11 +39,14 @@ typedef struct rw_lock {
#define RW_MAX_READERS 1000000 #define RW_MAX_READERS 1000000
#ifdef DEBUG #if 0 && KDEBUG // XXX disable this for now, it causes problems when including thread.h here
# include <thread.h> # include <thread.h>
#endif
#define ASSERT_LOCKED_RECURSIVE(r) { ASSERT(thread_get_current_thread_id() == (r)->holder); } #define ASSERT_LOCKED_RECURSIVE(r) { ASSERT(thread_get_current_thread_id() == (r)->holder); }
#define ASSERT_LOCKED_MUTEX(m) { ASSERT(thread_get_current_thread_id() == (m)->holder); } #define ASSERT_LOCKED_MUTEX(m) { ASSERT(thread_get_current_thread_id() == (m)->holder); }
#else
#define ASSERT_LOCKED_RECURSIVE(r)
#define ASSERT_LOCKED_MUTEX(m)
#endif
#ifdef __cplusplus #ifdef __cplusplus
+2 -2
View File
@@ -28,7 +28,7 @@
#endif #endif
/* prevent freeing pointers that were not allocated by kmalloc or are already freeed */ /* prevent freeing pointers that were not allocated by kmalloc or are already freeed */
#ifdef DEBUG #if KDEBUG > 1
# define PARANOID_POINTER_CHECK 1 # define PARANOID_POINTER_CHECK 1
#else #else
# define PARANOID_POINTER_CHECK 0 # define PARANOID_POINTER_CHECK 0
@@ -125,7 +125,7 @@ struct list sWalls;
#if PARANOID_POINTER_CHECK #if PARANOID_POINTER_CHECK
#define PTRCHECKLIST_ENTRIES 8192 #define PTRCHECKLIST_ENTRIES 32768
static void *ptrchecklist[PTRCHECKLIST_ENTRIES]; /* automatically initialized to zero */ static void *ptrchecklist[PTRCHECKLIST_ENTRIES]; /* automatically initialized to zero */
static void static void