| 1 |
|
| 2 |
# unix makefile for crashme program. |
| 3 |
|
| 4 |
CCFLAGS=-DPRNG_MT $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) |
| 5 |
DIST_VERSION=2.8.5 |
| 6 |
|
| 7 |
all: crashme pddet |
| 8 |
|
| 9 |
# make "CFLAGS=-Wall -DPRNG_MT -g"xo CC=gcc |
| 10 |
|
| 11 |
crashme: crashme.o vnsq.o mt19937ar.o |
| 12 |
$(CC) $(CCFLAGS) -o crashme crashme.o vnsq.o mt19937ar.o |
| 13 |
|
| 14 |
crashme.o: crashme.c |
| 15 |
$(CC) $(CCFLAGS) -c crashme.c |
| 16 |
|
| 17 |
pddet: pddet.o |
| 18 |
$(CC) $(CCFLAGS) -o pddet pddet.o |
| 19 |
|
| 20 |
pddet.o: pddet.c |
| 21 |
$(CC) $(CCFLAGS) -c pddet.c |
| 22 |
|
| 23 |
vnsq.o: vnsq.c |
| 24 |
$(CC) $(CCFLAGS) -c vnsq.c |
| 25 |
|
| 26 |
mt19937ar.o: mt19937ar.c |
| 27 |
$(CC) $(CCFLAGS) -c mt19937ar.c |
| 28 |
|
| 29 |
showdefs: |
| 30 |
$(CC) -dM -E - < /dev/null |
| 31 |
|
| 32 |
clean: |
| 33 |
-rm crashme pddet *.o core crashme.zip \ |
| 34 |
crashme.tgz crashme_i386.zip *.plg *.ncb *.opt |
| 35 |
-rm -rf release debug test-dist-tgz crashme-$(DIST_VERSION) |
| 36 |
|
| 37 |
# create for dist for people without nroff |
| 38 |
|
| 39 |
crashme.txt: crashme.man |
| 40 |
nroff -man crashme.man | col -bx > crashme.txt |
| 41 |
|
| 42 |
pddet.txt: pddet.man |
| 43 |
nroff -man pddet.man | col -bx > pddet.txt |
| 44 |
|
| 45 |
|
| 46 |
DIST_FILES = crashme.man crashme.c crashme.html \ |
| 47 |
crashme.vms-opt descrip.mms makefile \ |
| 48 |
pddet.c crashme.txt mt19937ar.h vnsq.h \ |
| 49 |
vnsq.c mt19937ar.c pddet.man pddet.txt |
| 50 |
|
| 51 |
# These files were in the distribution. |
| 52 |
# but they got lost and it isn't clear |
| 53 |
|
| 54 |
# crashme.dsw crashme.dsp pddet.dsp |
| 55 |
|
| 56 |
crashme.zip: $(DIST_FILES) |
| 57 |
zip -D -j crashme.zip $(DIST_FILES) |
| 58 |
|
| 59 |
crashme.tgz: $(DIST_FILES) |
| 60 |
tar cvf - $(DIST_FILES) | gzip -v > crashme.tgz |
| 61 |
|
| 62 |
check: |
| 63 |
#nsgmls -s crashme.html |
| 64 |
xmllint --noout crashme.html |
| 65 |
xmllint --noout downloads.html |
| 66 |
|
| 67 |
TAGS_SRC=$(DIST_FILES) downloads.html |
| 68 |
|
| 69 |
TAGS: $(TAGS_SRC) |
| 70 |
etags $(TAGS_SRC) |
| 71 |
|
| 72 |
dist: crashme.zip crashme.tgz |
| 73 |
|
| 74 |
dist-version: crashme-$(DIST_VERSION).tgz |
| 75 |
|
| 76 |
crashme-$(DIST_VERSION).tgz: $(DIST_FILES) |
| 77 |
rm -rf crashme-$(DIST_VERSION) |
| 78 |
mkdir crashme-$(DIST_VERSION) |
| 79 |
cp -a $(DIST_FILES) crashme-$(DIST_VERSION) |
| 80 |
tar cvfz crashme-$(DIST_VERSION).tgz crashme-$(DIST_VERSION) |
| 81 |
|
| 82 |
#crashme_i386.zip |
| 83 |
|
| 84 |
CRASHME_I386=release/crashme.exe release/pddet.exe |
| 85 |
|
| 86 |
crashme_i386.zip: $(DIST_FILES) $(CRASHME_I386) |
| 87 |
zip -D -j crashme_i386.zip $(DIST_FILES) $(CRASHME_I386) |
| 88 |
|
| 89 |
test-dist: crashme.tgz |
| 90 |
(rm -rf test-dist-tgz;\ |
| 91 |
mkdir test-dist-tgz;\ |
| 92 |
cd test-dist-tgz;\ |
| 93 |
tar xvfz ../crashme.tgz;\ |
| 94 |
make all dist ptest1 ptest7) |
| 95 |
|
| 96 |
test-dist-version: dist-version |
| 97 |
(cd crashme-$(DIST_VERSION);\ |
| 98 |
make all dist ptest1 ptest7) |
| 99 |
|
| 100 |
#### |
| 101 |
|
| 102 |
LOG_DIR=logs |
| 103 |
# This directory is in Apple Mac Darwin. |
| 104 |
# It will fill up with junk and probably really |
| 105 |
# slow down things unless you turn off crash reporting |
| 106 |
# for crashme. |
| 107 |
LOG_DIR2=$$HOME/Library/Logs/DiagnosticReports |
| 108 |
|
| 109 |
showcrashlogs: |
| 110 |
ls $(LOG_DIR) |
| 111 |
if [ -d $(LOG_DIR2) ]; then ls $(LOG_DIR2); fi |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
ptest1: |
| 117 |
./pddet |
| 118 |
|
| 119 |
ptest2: |
| 120 |
./crashme 100 666 100 |
| 121 |
|
| 122 |
ptest3: |
| 123 |
./crashme 100 667 100 |
| 124 |
|
| 125 |
ptest4: |
| 126 |
mkdir -p $(LOG_DIR) |
| 127 |
sh -c "CRASHPRNG=RAND;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-ptest4.log;export CRASHLOG;./crashme 100 666 100" |
| 128 |
|
| 129 |
|
| 130 |
ptest5: |
| 131 |
./crashme -100 666 100 |
| 132 |
|
| 133 |
ptest6: |
| 134 |
@echo This tests alarm clock |
| 135 |
@echo you can also use control-C |
| 136 |
./crashme 0 666 3 |
| 137 |
|
| 138 |
ptest7: |
| 139 |
./crashme +256 666 10 3 |
| 140 |
|
| 141 |
ptest8: |
| 142 |
./crashme +256 666 10 3 4 |
| 143 |
|
| 144 |
ptest9: |
| 145 |
./crashme +256 666 100 3 4 |
| 146 |
|
| 147 |
ptest10: |
| 148 |
./crashme +4096 666 100 00:00:05 4 |
| 149 |
|
| 150 |
ptest11: |
| 151 |
./crashme +4096 666 250 00:03:00 4 |
| 152 |
|
| 153 |
|
| 154 |
# here are some tests taken from the BAT files done for windows. |
| 155 |
|
| 156 |
test1: test1a test1b test1c |
| 157 |
|
| 158 |
test1a: |
| 159 |
mkdir -p $(LOG_DIR) |
| 160 |
./pddet -examine 16 |
| 161 |
./pddet -examine 16 > $(LOG_DIR)/pddet.log |
| 162 |
|
| 163 |
test1b: |
| 164 |
sh -c "CRASHPRNG=MT;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_mt.log |
| 165 |
sh -c "CRASHPRNG=RAND;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_rand.log |
| 166 |
sh -c "CRASHPRNG=VNSQ;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_vnsq.log |
| 167 |
|
| 168 |
test1c: test1ca test1cb test1cc |
| 169 |
|
| 170 |
test1ca: |
| 171 |
sh -c "CRASHPRNG=MT;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-mt.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3" |
| 172 |
|
| 173 |
test1cb: |
| 174 |
sh -c "CRASHPRNG=RAND;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-rand.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3" |
| 175 |
|
| 176 |
|
| 177 |
test1cc: |
| 178 |
sh -c "CRASHPRNG=VNSQ;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-vnsq.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3" |
| 179 |
|
| 180 |
test-mt19937ar: mt19937ar_main |
| 181 |
./mt19937ar_main |
| 182 |
|
| 183 |
mt19937ar_main: mt19937ar.c |
| 184 |
$(CC) $(CCFLAGS) -DMT19937AR_MAIN -o mt19937ar_main mt19937ar.c |
| 185 |
|
| 186 |
|
| 187 |
### Use these targets to disable all crash report generation, |
| 188 |
### otherwise large amounts of system resources could be consumed. |
| 189 |
|
| 190 |
### These targets are for Apple Mac. |
| 191 |
|
| 192 |
report-crash-stop: |
| 193 |
-launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist |
| 194 |
-sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist |
| 195 |
|
| 196 |
report-crash-start: |
| 197 |
-launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist |
| 198 |
-sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist |
| 199 |
|
| 200 |
### These commands work in some linux environments. |
| 201 |
### An alternative would configuration of ~/.apport-ignore.xml or /etc/apport |
| 202 |
### to tell apport to ignore crashme. But that still that leaves |
| 203 |
### /proc/sys/kernel/core_pattern |
| 204 |
### sending a large number of crash dumps to apport. |
| 205 |
|
| 206 |
APPORT_INIT=/etc/init.d/apport |
| 207 |
CORE_PATTERN_API=/proc/sys/kernel/core_pattern |
| 208 |
CORE_PATTERN=core-%p-%u-%g-%s-%t-%h-%e |
| 209 |
|
| 210 |
apport-crash-stop: |
| 211 |
sudo $(APPORT_INIT) stop |
| 212 |
cat $(CORE_PATTERN_API) |
| 213 |
|
| 214 |
apport-crash-start: |
| 215 |
sudo $(APPORT_INIT) start |
| 216 |
cat $(CORE_PATTERN_API) |
| 217 |
|
| 218 |
set-core-pattern: |
| 219 |
sudo sh -c 'echo $(CORE_PATTERN) > $(CORE_PATTERN_API)' |
| 220 |
cat $(CORE_PATTERN_API) |
| 221 |
|
| 222 |
show-core-limit: |
| 223 |
bash -c "ulimit -a" |
| 224 |
|
| 225 |
# |
| 226 |
ps: |
| 227 |
-ps -C crashme -f -H |
| 228 |
|
| 229 |
pgrep: |
| 230 |
-pgrep -l crashme |
| 231 |
|
| 232 |
pkill: |
| 233 |
-pkill crashme |
| 234 |
|