[pypy-svn] r34753 - in pypy/dist/pypy/translator/c: . src

arigo at codespeak.net arigo at codespeak.net
Sun Nov 19 14:54:50 CET 2006


Author: arigo
Date: Sun Nov 19 14:54:48 2006
New Revision: 34753

Modified:
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/src/standalone.h
Log:
(pedronis, arigo)

A makefile target 'debug_mem' that compiles without obmalloc, making
debugging under valgrind possible.  Note that for pypy-c translations
you can recompile the main file only (testing_1.c) instead of all
of them.


Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Sun Nov 19 14:54:48 2006
@@ -864,6 +864,9 @@
 debug_exc:
 \tmake CFLAGS="-g -DDO_LOG_EXC"
 
+debug_mem:
+\tmake CFLAGS="-g -DNO_OBMALLOC"
+
 profile:
 \tmake CFLAGS="-pg $(CFLAGS)" LDFLAGS="-pg $(LDFLAGS)"
 

Modified: pypy/dist/pypy/translator/c/src/standalone.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/standalone.h	(original)
+++ pypy/dist/pypy/translator/c/src/standalone.h	Sun Nov 19 14:54:48 2006
@@ -5,8 +5,16 @@
 #include <math.h>
 
 #ifndef PYPY_NOT_MAIN_FILE
-#ifndef WITH_PYMALLOC
-#define WITH_PYMALLOC
+
+#ifdef NO_OBMALLOC
+void *PyObject_Malloc(size_t n) { return malloc(n); }
+void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
+void PyObject_Free(void *p) { if (p) { *((int*)p) = 0xDDDDDDDD; } free(p); }
+#else
+#  ifndef WITH_PYMALLOC
+#    define WITH_PYMALLOC
+#  endif
+#  include "obmalloc.c"
 #endif
-#include "obmalloc.c"
+
 #endif



More information about the Pypy-commit mailing list