From ac653a30df0e86b403333b4d9a78aba5df8aa7f7 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 15 Feb 2010 21:35:07 +0000 Subject: [PATCH] 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35481 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/malloc_debug.h | 1 + .../libroot/posix/malloc_debug/heap.cpp | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/headers/posix/malloc_debug.h b/headers/posix/malloc_debug.h index 65c368317f..7267931a7f 100644 --- a/headers/posix/malloc_debug.h +++ b/headers/posix/malloc_debug.h @@ -16,6 +16,7 @@ status_t heap_debug_stop_wall_checking(); 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(); diff --git a/src/system/libroot/posix/malloc_debug/heap.cpp b/src/system/libroot/posix/malloc_debug/heap.cpp index c979ec4d2a..26748815ab 100644 --- a/src/system/libroot/posix/malloc_debug/heap.cpp +++ b/src/system/libroot/posix/malloc_debug/heap.cpp @@ -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 @@ panic(const char *format, ...) vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); - debugger(buffer); + if (sDebuggerCalls) + debugger(buffer); + else + debug_printf(buffer); } @@ -52,11 +62,6 @@ panic(const char *format, ...) #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; @@ -1656,6 +1661,13 @@ heap_debug_set_memory_reuse(bool enabled) } +extern "C" void +heap_debug_set_debugger_calls(bool enabled) +{ + sDebuggerCalls = enabled; +} + + extern "C" void heap_debug_validate_heaps() {