add a simple test of mtrace

master
neingeist 11 years ago
parent c8683cda1c
commit 9527b11c57

3
.gitignore vendored

@ -23,3 +23,6 @@ test-inline-assembly
test-inline-assembly.s test-inline-assembly.s
uiowa-threads-example uiowa-threads-example
tags tags
mtrace-test
mtrace-test.trace
mtrace-test.txt

@ -1,7 +1,9 @@
CFLAGS=-std=c99 -Wextra -pedantic -g -O2 CFLAGS=-std=c99 -Wextra -pedantic -g -O2
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example CFLAGS=-std=c99 -Wextra -pedantic -g -O0
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example mtrace-test
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags mtrace-test.trace mtrace-test.txt
.PHONY: all .PHONY: all
all: $(TARGETS) $(EXTRAS) all: $(TARGETS) $(EXTRAS)
@ -50,5 +52,11 @@ test-inline-assembly: test-inline-assembly.c
test-inline-assembly.s: test-inline-assembly.c test-inline-assembly.s: test-inline-assembly.c
$(CC) -Wall -S -o $@ $< $(CC) -Wall -S -o $@ $<
mtrace-test.trace: mtrace-test
MALLOC_TRACE=$@ ./mtrace-test
mtrace-test.txt: mtrace-test.trace
-mtrace mtrace-test mtrace-test.trace > mtrace-test.txt
uiowa-threads-example: uiowa-threads.o uiowa-threads-example.c uiowa-threads-example: uiowa-threads.o uiowa-threads-example.c
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^

@ -0,0 +1,12 @@
#include <mcheck.h>
#include <stdlib.h>
int main(void) {
mtrace();
int* a = malloc(sizeof(int));
muntrace();
exit(EXIT_SUCCESS);
}
Loading…
Cancel
Save