summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorRobin Watts <robin@peeves.(none)>2016-03-05 14:32:40 -0800
committerRobin Watts <robin.watts@artifex.com>2016-03-07 12:40:58 +0000
commit497c1196373ed40d9ed9cf045405be7df6ac55c4 (patch)
tree1ac035cb91365c7c87b1ce92326a1993ce599bc5 /Makerules
parentba1365e1d7c3cc673e9516c2423322edfb8a02d7 (diff)
downloadmupdf-497c1196373ed40d9ed9cf045405be7df6ac55c4.tar.xz
Memento: Store/display backtraces with blocks.
If built with MEMENTO_DETAILS (on by default), we store the backtrace on every event that affects a block. Memento_details(address) will display the events that affected a block (typically malloc, {realloc}*, free), including the backtrace at each point. Windows and linux use different mechanisms for this. Windows loads a DLL and calls windows specific functions - no extra libraries are required. Linux also loads a shared object (libbacktrace.so). This is not present on all platforms, so on platforms where it is not available we just get addresses. These can be converted using addr2line (unless ASLR is enabled). In order for linux to be able to load libbacktrace.so we link in libdl. If this is not available, define HAVE_LIBDL=no when building the memento target.
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makerules b/Makerules
index 013b2e20..d6041d28 100644
--- a/Makerules
+++ b/Makerules
@@ -5,10 +5,13 @@ OS := $(OS:MINGW%=MINGW)
OS := $(OS:Windows_NT=MINGW)
OS := $(OS:Darwin=MACOS)
+HAVE_LIBDL ?= yes
+
CFLAGS += -Wall
ifeq "$(build)" "debug"
CFLAGS += -pipe -g -DDEBUG
+LDFLAGS += -g
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
else ifeq "$(build)" "sanitize"
@@ -24,6 +27,11 @@ else ifeq "$(build)" "native"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -march=native -mfpmath=sse
else ifeq "$(build)" "memento"
CFLAGS += -pipe -g -DMEMENTO -DDEBUG
+LDFLAGS += -g -d -rdynamic
+ifeq "$(HAVE_LIBDL)" "yes"
+CFLAGS += -DHAVE_LIBDL
+LDFLAGS += -ldl
+endif
else
$(error unknown build setting: '$(build)')
endif