Commit e21bb8f2 authored by Marius Wachtler's avatar Marius Wachtler

add a cmake option to enable memory debugging and refcounting debug support

previously we checked if NDEBUG was defiend but this caused problems with extensions which modified this define
parent 578297b9
......@@ -49,6 +49,7 @@ option(ENABLE_LLVM_DEBUG "LLVM debug symbols" OFF)
option(ENABLE_OPROFILE "enable oprofile support" OFF)
option(ENABLE_SELF_HOST "use pyston to test pyston" OFF)
option(ENABLE_VALGRIND "pyston valgrind support" OFF)
option(ENABLE_REF_DEBUG "enable memory and refcounting debugging" OFF)
option(ENABLE_PGO "enable -fprofile-generate/-fprofile-use" OFF)
option(ENABLE_LTO "enable -flto" OFF)
......@@ -105,6 +106,12 @@ if(ENABLE_PGO)
set(PGO_FLAGS "-fprofile-${PROFILE_STATE} -fprofile-correction")
endif()
if(ENABLE_REF_DEBUG)
add_definitions(-DPy_REF_DEBUG)
add_definitions(-DPYMALLOC_DEBUG)
add_definitions(-DPy_TRACE_REFS)
endif()
macro(ADD_PROFILE_FLAGS)
set(PROFILE_FLAGS "${PGO_FLAGS} ${LTO_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_FLAGS}")
......
......@@ -655,7 +655,7 @@ $(CMAKE_SETUP_DBG):
@$(MAKE) cmake_check
@$(MAKE) clang_check
@mkdir -p $(CMAKE_DIR_DBG)
cd $(CMAKE_DIR_DBG); CC='clang' CXX='clang++' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug
cd $(CMAKE_DIR_DBG); CC='clang' CXX='clang++' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -DENABLE_REF_DEBUG=ON
$(CMAKE_SETUP_RELEASE):
@$(MAKE) cmake_check
@$(MAKE) clang_check
......
......@@ -4,4 +4,8 @@ else()
set(EXT_BUILD_FLAGS "-g -O0")
endif()
if (${ENABLE_REF_DEBUG})
set(EXT_BUILD_FLAGS "-DPy_REF_DEBUG -DPYMALLOC_DEBUG -DPy_TRACE_REFS ${EXT_BUILD_FLAGS}")
endif()
configure_file(lib_pyston/_sysconfigdata.py.in lib_pyston/_sysconfigdata.py)
......@@ -21,12 +21,6 @@
#define PYSTON_VERSION "0.5"
#define WITH_PYMALLOC
// XXX: testing
#ifndef NDEBUG
#define Py_REF_DEBUG
#define PYMALLOC_DEBUG
#define Py_TRACE_REFS
#endif
// These include orders come from CPython:
#include "patchlevel.h"
......
......@@ -6,6 +6,8 @@ CMAKE_ARGS="-GNinja -DTEST_THREADS=4 $TRAVIS_BUILD_DIR -DCMAKE_BUILD_TYPE=${TRAV
if [ "${TRAVIS_BUILD_TYPE}" = "Release" ]; then
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_EXTRA_TESTS=ON"
else
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_REF_DEBUG=ON"
fi
cmake ${CMAKE_ARGS}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment