Add Makefile.common switch ALLOCACHE_AS_MALLOC, remove DEBUG_WITH_VALGRIND.

git-svn-id: https://svn.eduke32.com/eduke32@4298 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-02-08 14:37:41 +00:00
parent f0da70b4c1
commit 0d0f3a1cd2
5 changed files with 39 additions and 28 deletions

View file

@ -178,6 +178,12 @@ DMALLOC?=0
PROFILER?=0
MUDFLAP?=0
# Make allocache() a wrapper around malloc()? Useful for debugging
# allocache()-allocated memory accesses with e.g. Valgrind.
# For debugging with Valgrind + GDB, see
# http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
ALLOCACHE_AS_MALLOC?=0
# Select the default optimization level for release and debug builds.
ifeq ($(RELEASE),0)
OPTLEVEL?=0
@ -343,6 +349,10 @@ endif
debug+= -O$(OPTLEVEL)
ifneq ($(ALLOCACHE_AS_MALLOC),0)
debug+= -DDEBUG_ALLOCACHE_AS_MALLOC
endif
# See http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
# for a list of possible UBSan options.
# Clang 3.2 does only supports -fsanitize=address for the AddressSanitizer

View file

@ -8,15 +8,6 @@
#include "a.h"
// For this, it's also sensible to uncomment DEBUG_ALLOCACHE_AS_MALLOC:
//#define DEBUG_WITH_VALGRIND
#ifdef DEBUG_WITH_VALGRIND
// For debugging with Valgrind + GDB, see
// http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
# include <valgrind/memcheck.h>
#endif
#ifdef ENGINE_USING_A_C
int32_t krecip(int32_t num); // from engine.c
@ -131,20 +122,10 @@ static inline uint32_t ourmulscale32(uint32_t a, uint32_t b)
static inline int32_t getpix(int32_t logy, const char *buf, uint32_t vplc)
{
if (logy != 0)
{
#ifdef DEBUG_WITH_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(&buf[vplc>>logy], 1);
#endif
return buf[vplc>>logy];
}
else
{
#ifdef DEBUG_WITH_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(&buf[ourmulscale32(vplc,globaltilesizy)], 1);
#endif
return buf[ourmulscale32(vplc,globaltilesizy)];
}
}
void setupvlineasm(int32_t neglogy) { glogy = neglogy; }
// cnt+1 loop iterations!

View file

@ -83,10 +83,6 @@ static intptr_t kzipopen(const char *filnam)
// After calling uninitcache, it is still ok to call allocache
// without first calling initcache.
// Uncomment for easier allocache-allocated bound checking (e.g. with Valgrind)
// KEEPINSYNC game.c
//#define DEBUG_ALLOCACHE_AS_MALLOC
#define MAXCACHEOBJECTS 9216
#if !defined DEBUG_ALLOCACHE_AS_MALLOC

View file

@ -1371,10 +1371,6 @@ void G_GameQuit(void)
G_GameExit("Timed out.");
}
// Uncomment for easier allocache-allocated bound checking (e.g. with Valgrind)
// KEEPINSYNC cache1d.c
//#define DEBUG_ALLOCACHE_AS_MALLOC
#if !defined DEBUG_ALLOCACHE_AS_MALLOC
extern int32_t cacnum;
extern cactype cac[];

View file

@ -1,8 +1,10 @@
build: LTO=0 WITHOUT_GTK=1 RELEASE=0 LUNATIC=0 make
build: ALLOCACHE_AS_MALLOC=1 LTO=0 WITHOUT_GTK=1 RELEASE=0 LUNATIC=0 make
platform: Linux/x86_64
----------
See the comment in MV_Init().
Thread 3:
Invalid read of size 2
at 0x8730513: MV_Mix16BitStereo16Stereo (mixst.c:272)
@ -134,3 +136,29 @@ Invalid read of size 1
by 0x507589: M32_DrawRoomsAndMasks (build.c:479)
by 0x507F69: app_main (build.c:742)
by 0x502328: main (sdlayer.c:278)
----------
BLiGHT: strafing (tilts the screen).
Invalid read of size 1
at 0x5BE3A6: vlineasm4 (a-c.c:125)
by 0x532C3E: wallscan (engine.c:3905)
by 0x5356CB: parascan (engine.c:4607)
by 0x536288: drawalls (engine.c:4853)
by 0x5449BF: drawrooms (engine.c:9052)
by 0x529FAA: yax_drawrooms (engine.c:1174)
by 0x43C627: G_DrawRooms (game.c:4650)
by 0x45426D: app_main (game.c:12014)
by 0x5BA9A5: main (sdlayer.c:278)
Address 0x26c8a44a is 10 bytes after a block of size 128,000 alloc'd
at 0x11C852DB: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x51D524: allocache (cache1d.c:160)
by 0x54D0B2: loadtile (engine.c:11521)
by 0x4F3BF4: G_CacheMapData (premap.c:487)
by 0x4F930A: G_EnterLevel (premap.c:1910)
by 0x4BC269: G_NewGame_EnterLevel (game.h:553)
by 0x4C5364: M_DisplayMenus (menus.c:2442)
by 0x486A91: G_PlaybackDemo (demo.c:936)
by 0x453A46: app_main (game.c:11844)
by 0x5BA9A5: main (sdlayer.c:278)