From 0ee91da42f5e0c07767da0b2c59800fa5269cfa8 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Mon, 2 Dec 2013 11:00:43 +0100 Subject: [PATCH] valgrind target --- boards/native/Makefile.include | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index c7891c6c46..da4dd5eedf 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -14,12 +14,15 @@ export OBJCOPY = $(PREFIX)objcopy export DEBUGGER = gdb export TERMPROG = $(ELF) export FLASHER = true +export VALGRIND ?= valgrind # flags: export CFLAGS += -std=gnu99 -Wall -Wextra -pedantic -m32 export LINKFLAGS += -m32 -gc -ldl export ASFLAGS = export DEBUGGER_FLAGS = $(ELF) +export VALGRIND_FLAGS ?= --track-origins=yes +all-valgrind: export CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -g ifneq (,$(findstring nativenet,$(USEMODULE))) export PORT ?= tap0 @@ -27,4 +30,14 @@ else export PORT = endif +all: # do not override first target + +all-valgrind: all + +valgrind: +# use this if you want to attach gdb from valgrind: +# echo 0 > /proc/sys/kernel/yama/ptrace_scope +# VALGRIND_FLAGS += --db-attach=yes + $(VALGRIND) $(VALGRIND_FLAGS) $(ELF) $(PORT) + include $(RIOTBOARD)/$(BOARD)/Makefile.dep