1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
--- Makefile.i386.orig Sun Oct 19 02:01:03 2003
+++ Makefile.i386 Sun Oct 19 02:01:28 2003
@@ -0,0 +1,149 @@
+# %M% %I% %G% %U%
+# Copyright (c) 1987, Benjamin G. Zorn
+#
+# Makefile for MPROF data generation
+#
+
+CC ?= cc
+
+# mips CFLAGS = -I. -g -DDEBUG
+# sun4 CFLAGS = -I. -g -Dsun4
+# sun3,vax, i386 CFLAGS = -I. -g
+
+# sun4 ASFLAGS = -P -Dsun4
+# sun3,vax,mips, i386 ASFLAGS =
+
+CFLAGS ?= -O -pipe
+CFLAGS += -I. -g -static
+ASFLAGS =
+BIN = .
+MPLIB = $(BIN)/libc_mp.a
+LINTFLAGS = -bhx
+
+# sun4,mips ASM_SRC = md.s
+# sun4,mips ASM_OBJ = md.o
+# vax,sun3 ASM_SRC =
+# vax,sun3 ASM_OBJ =
+
+ASM_SRC =
+ASM_OBJ =
+
+MPROF_MON_SRCS = leak.c malloc.c mpattach.c mprof_mon.c mpstruct.c $(ASM_SRC)
+MPROF_MON_OBJS = leak.o malloc.o mpattach.o mprof_mon.o mpstruct.o $(ASM_OBJ)
+
+MPROF_SRCS = mprof.c mpstruct.c mpgraph.c
+MPROF_OBJS = mprof.o mpstruct.o mpgraph.o
+
+DOC_SRC = mprof.1
+DOC_OBJS = mprof.man
+
+DISTNAME = mprof-3.0
+
+TEST_SRCS = test1.c test2.c
+TEST_OBJS = test1.o test2.o
+
+all: mprof $(MPROF_MON_OBJS) $(DOC_OBJS) $(MPLIB)
+
+mips $(MPLIB): $(MPROF_MON_OBJS)
+ ar cr libc_mp.a $(MPROF_MON_OBJS)
+ ranlib libc_mp.a
+
+# sun3, sun4 LIB_REPLACE = memalign.o
+# vax LIB_REPLACE = exit.o
+# mips LIB_REPLACE =
+
+LIB_REPLACE = exit.o
+
+#$(MPLIB): $(MPROF_MON_OBJS)
+# cp /lib/libc.a libc_mp.a
+# ar d libc_mp.a malloc.o valloc.o $(LIB_REPLACE)
+# ar r libc_mp.a $(MPROF_MON_OBJS)
+# ranlib libc_mp.a
+
+test: $(TEST_OBJS) test1-demo test2-demo
+
+mprof-mon-lint:
+ lint $(LINTFLAGS) $(MPROF_MON_SRCS) > mprof.lint
+
+mprof-lint:
+ lint $(LINTFLAGS) $(MPROF_SRCS) > mprof.lint
+
+clean:
+ rm -f *.o mprof.lint mprof-mon.lint \
+ $(DOC_OBJS) \
+ $(TEST_OBJS) \
+ test1 test1.data test1.mprof \
+ test2 test2.data test2.mprof \
+ libc_mp.a mprof mprof.data
+
+leak.o: leak.c
+mprof_mon.o: mprof_mon.c
+mpstruct.o: mpstruct.c
+mpgraph.o: mpgraph.c
+mprof.o: mprof.c
+md.o: md.s
+ $(AS) $(ASFLAGS) -o md.o md.s
+
+malloc.o: malloc.c
+ $(CC) $(CFLAGS) -Dmalloc=__malloc__ -Dfree=__free__ -Drealloc=__realloc__ malloc.c -c
+
+mprof: $(MPROF_OBJS)
+ $(CC) $(CFLAGS) -o mprof $(MPROF_OBJS)
+
+mprof.man: mprof.1
+ nroff -man mprof.1 > mprof.man
+
+dist: MANIFEST
+ tar cvf $(DISTNAME).tar `cat MANIFEST`
+ compress $(DISTNAME).tar
+
+#
+# Examples to test if MPROF is installed correctly
+#
+
+# A very simple test (tests calloc and valloc)
+
+test1-demo: test1.data
+ $(BIN)/mprof -normal test1 test1.data > test1.mprof
+
+test1.mprof: test1.data
+ $(BIN)/mprof -normal test1 test1.data > test1.mprof
+
+test1.data: test1
+ test1
+ cp mprof.data test1.data
+
+test1: test1.o $(MPLIB)
+ $(CC) $(CFLAGS) -o test1 test1.o $(MPLIB)
+
+test1.o: test1.c
+
+
+# test2 program (example from paper)
+
+test2-demo: test2.data
+ $(BIN)/mprof -normal test2 test2.data > test2.mprof
+
+test2.mprof: test2.data
+ $(BIN)/mprof -normal test2 test2.data > test2.mprof
+
+test2.data: test2
+ test2
+ cp mprof.data test2.data
+
+test2: test2.o $(MPLIB)
+ $(CC) $(CFLAGS) -o test2 test2.o $(MPLIB)
+
+test2.o: test2.c
+
+
+###
+leak.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h
+malloc.o: /usr/include/sys/types.h /usr/include/stdio.h
+mprof.o: /usr/include/stdio.h /usr/include/sys/file.h /usr/include/ctype.h \
+ /usr/include/a.out.h /usr/include/sys/exec.h /usr/include/stab.h \
+ mprof.h /usr/include/sys/types.h
+mprof_mon.o: /usr/include/stdio.h /usr/include/sys/file.h mprof.h \
+ /usr/include/sys/types.h
+mpstruct.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h
+mpgraph.o: /usr/include/stdio.h mprof.h /usr/include/sys/types.h
|