From 27d02ccd424db135f19fb9480759d22676ed62ff Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Wed, 16 Oct 2024 17:55:08 +0200 Subject: [PATCH] baselibc: Add option to enable extra debugging for malloc/free --- libc/baselibc/pkg.yml | 3 +++ libc/baselibc/syscfg.yml | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/libc/baselibc/pkg.yml b/libc/baselibc/pkg.yml index aa232757e2..302f9b4196 100644 --- a/libc/baselibc/pkg.yml +++ b/libc/baselibc/pkg.yml @@ -34,5 +34,8 @@ pkg.init.BASELIBC_THREAD_SAFE_HEAP_ALLOCATION: pkg.cflags: - -fno-builtin-malloc +pkg.cflags.BASELIBC_DEBUG_MALLOC: + - -DDEBUG_MALLOC + pkg.lflags: - -umain diff --git a/libc/baselibc/syscfg.yml b/libc/baselibc/syscfg.yml index 9820d8ed39..af331589f0 100644 --- a/libc/baselibc/syscfg.yml +++ b/libc/baselibc/syscfg.yml @@ -41,3 +41,9 @@ syscfg.defs: description: > Set to 1 if project requires malloc/calloc/free to be thread safe. value: 0 + + BASELIBC_DEBUG_MALLOC: + description: > + Set to 1 to enable extra debugging for malloc/free calls. + This will e.g. assert on double-free. + value: 0