[haiku-commits] r35481 - in haiku/trunk: headers/posix src/system/libroot/posix/malloc_debug

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 15 Feb 2010 22:35:07 +0100 (CET)

Author: mmlr
Date: 2010-02-15 22:35:07 +0100 (Mon, 15 Feb 2010)
New Revision: 35481
Changeset: http://dev.haiku-os.org/changeset/35481/haiku

Modified:
   haiku/trunk/headers/posix/malloc_debug.h
   haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp
Log:
Add heap_debug_set_debugger_calls() which allows to disable debugger calls for
the heap debug panics. Instead syslog output is generated if turned off.


Modified: haiku/trunk/headers/posix/malloc_debug.h
===================================================================
--- haiku/trunk/headers/posix/malloc_debug.h    2010-02-15 20:57:52 UTC (rev 
35480)
+++ haiku/trunk/headers/posix/malloc_debug.h    2010-02-15 21:35:07 UTC (rev 
35481)
@@ -16,6 +16,7 @@
 
 void heap_debug_set_memory_reuse(bool enabled);
 void heap_debug_set_paranoid_validation(bool enabled);
+void heap_debug_set_debugger_calls(bool enabled);
 void heap_debug_validate_heaps();
 void heap_debug_validate_walls();
 

Modified: haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp
===================================================================
--- haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp  2010-02-15 
20:57:52 UTC (rev 35480)
+++ haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp  2010-02-15 
21:35:07 UTC (rev 35481)
@@ -32,6 +32,13 @@
 #define ASSERT(x)      if (!(x)) panic("assert failed: %s", #x);
 
 
+static bool sDebuggerCalls = true;
+static bool sReuseMemory = true;
+static bool sParanoidValidation = false;
+static thread_id sWallCheckThread = -1;
+static bool sStopWallChecking = false;
+
+
 void
 panic(const char *format, ...)
 {
@@ -42,7 +49,10 @@
        vsnprintf(buffer, sizeof(buffer), format, args);
        va_end(args);
 
-       debugger(buffer);
+       if (sDebuggerCalls)
+               debugger(buffer);
+       else
+               debug_printf(buffer);
 }
 
 
@@ -52,11 +62,6 @@
 #define HEAP_GROW_SIZE                         2 * 1024 * 1024
 #define HEAP_AREA_USE_THRESHOLD                1 * 1024 * 1024
 
-static bool sReuseMemory = true;
-static bool sParanoidValidation = false;
-static thread_id sWallCheckThread = -1;
-static bool sStopWallChecking = false;
-
 typedef struct heap_leak_check_info_s {
        size_t          size;
        thread_id       thread;
@@ -1657,6 +1662,13 @@
 
 
 extern "C" void
+heap_debug_set_debugger_calls(bool enabled)
+{
+       sDebuggerCalls = enabled;
+}
+
+
+extern "C" void
 heap_debug_validate_heaps()
 {
        for (uint32 i = 0; i < HEAP_CLASS_COUNT; i++)


Other related posts:

  • » [haiku-commits] r35481 - in haiku/trunk: headers/posix src/system/libroot/posix/malloc_debug - mmlr