git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] Makefile: describe XMALLOC_POISON
Date: Wed, 13 Jan 2016 22:56:44 +0600	[thread overview]
Message-ID: <1452704204-1928-1-git-send-email-kuleshovmail@gmail.com> (raw)
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

  reply	other threads:[~2016-01-13 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 11:57 [PATCH] Makefile: describe XMALLOC_POISON Alexander Kuleshov
2016-01-13 16:56 ` Alexander Kuleshov [this message]
2016-01-13 18:23   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452704204-1928-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).