git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Makefile: describe XMALLOC_POISON

From
Alexander Kuleshov <kuleshovmail@gmail.com>
Date
Jan 13, 2016, 16:56 UTC
Message-ID
<1452704204-1928-1-git-send-email-kuleshovmail@gmail.com>
In-Reply-To
<1452686255-8757-1-git-send-email-kuleshovmail@gmail.com>

The do_xmalloc() functions may fill an allocated buffer with the known value (0xA5) for debugging if we will pass the XMALLOC_POISON option during build.

This patch adds description of this option to the Makefile and adds it to BASIC_CFLAGS if it was provided.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index f3325de..3f942b5 100644
--- a/Makefile
+++ b/Makefile
@@ -367,6 +367,10 @@ all::
 # Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
 #
 # Define HAVE_GETDELIM if your system has the getdelim() function.
+#
+# Define XMALLOC_POISON if you are debugging the xmalloc(). In a XMALLOC_POISON
+# build, each allocated buffer by the xmalloc() will be in known state. After
+# memory allocation, a buffer will be filled with '0xA5' values.
 
 GIT-VERSION-FILE: FORCE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1481,6 +1485,10 @@ ifdef HAVE_GETDELIM
 	BASIC_CFLAGS += -DHAVE_GETDELIM
 endif
 
+ifdef XMALLOC_POISON
+	BASIC_CFLAGS += -DXMALLOC_POISON
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
-- 
2.7.0.25.gfc10eb5
Previous: Alexander KuleshovNext: Junio C Hamano
Message 2 of 3 in “Makefile: describe XMALLOC_POISON”
  1. Makefile: describe XMALLOC_POISONAlexander Kuleshov, Jan 13, 2016
  2. Makefile: describe XMALLOC_POISONAlexander Kuleshov, Jan 13, 2016
  3. Junio C HamanoJan 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.