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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
# unix makefile for crashme program.
CCFLAGS=-DPRNG_MT $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
DIST_VERSION=2.8.5
all: crashme pddet
# make "CFLAGS=-Wall -DPRNG_MT -g"xo CC=gcc
crashme: crashme.o vnsq.o mt19937ar.o
$(CC) $(CCFLAGS) -o crashme crashme.o vnsq.o mt19937ar.o
crashme.o: crashme.c
$(CC) $(CCFLAGS) -c crashme.c
pddet: pddet.o
$(CC) $(CCFLAGS) -o pddet pddet.o
pddet.o: pddet.c
$(CC) $(CCFLAGS) -c pddet.c
vnsq.o: vnsq.c
$(CC) $(CCFLAGS) -c vnsq.c
mt19937ar.o: mt19937ar.c
$(CC) $(CCFLAGS) -c mt19937ar.c
showdefs:
$(CC) -dM -E - < /dev/null
clean:
-rm crashme pddet *.o core crashme.zip \
crashme.tgz crashme_i386.zip *.plg *.ncb *.opt
-rm -rf release debug test-dist-tgz crashme-$(DIST_VERSION)
# create for dist for people without nroff
crashme.txt: crashme.man
nroff -man crashme.man | col -bx > crashme.txt
pddet.txt: pddet.man
nroff -man pddet.man | col -bx > pddet.txt
DIST_FILES = crashme.man crashme.c crashme.html \
crashme.vms-opt descrip.mms makefile \
pddet.c crashme.txt mt19937ar.h vnsq.h \
vnsq.c mt19937ar.c pddet.man pddet.txt
# These files were in the distribution.
# but they got lost and it isn't clear
# crashme.dsw crashme.dsp pddet.dsp
crashme.zip: $(DIST_FILES)
zip -D -j crashme.zip $(DIST_FILES)
crashme.tgz: $(DIST_FILES)
tar cvf - $(DIST_FILES) | gzip -v > crashme.tgz
check:
#nsgmls -s crashme.html
xmllint --noout crashme.html
xmllint --noout downloads.html
TAGS_SRC=$(DIST_FILES) downloads.html
TAGS: $(TAGS_SRC)
etags $(TAGS_SRC)
dist: crashme.zip crashme.tgz
dist-version: crashme-$(DIST_VERSION).tgz
crashme-$(DIST_VERSION).tgz: $(DIST_FILES)
rm -rf crashme-$(DIST_VERSION)
mkdir crashme-$(DIST_VERSION)
cp -a $(DIST_FILES) crashme-$(DIST_VERSION)
tar cvfz crashme-$(DIST_VERSION).tgz crashme-$(DIST_VERSION)
#crashme_i386.zip
CRASHME_I386=release/crashme.exe release/pddet.exe
crashme_i386.zip: $(DIST_FILES) $(CRASHME_I386)
zip -D -j crashme_i386.zip $(DIST_FILES) $(CRASHME_I386)
test-dist: crashme.tgz
(rm -rf test-dist-tgz;\
mkdir test-dist-tgz;\
cd test-dist-tgz;\
tar xvfz ../crashme.tgz;\
make all dist ptest1 ptest7)
test-dist-version: dist-version
(cd crashme-$(DIST_VERSION);\
make all dist ptest1 ptest7)
####
LOG_DIR=logs
# This directory is in Apple Mac Darwin.
# It will fill up with junk and probably really
# slow down things unless you turn off crash reporting
# for crashme.
LOG_DIR2=$$HOME/Library/Logs/DiagnosticReports
showcrashlogs:
ls $(LOG_DIR)
if [ -d $(LOG_DIR2) ]; then ls $(LOG_DIR2); fi
ptest1:
./pddet
ptest2:
./crashme 100 666 100
ptest3:
./crashme 100 667 100
ptest4:
mkdir -p $(LOG_DIR)
sh -c "CRASHPRNG=RAND;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-ptest4.log;export CRASHLOG;./crashme 100 666 100"
ptest5:
./crashme -100 666 100
ptest6:
@echo This tests alarm clock
@echo you can also use control-C
./crashme 0 666 3
ptest7:
./crashme +256 666 10 3
ptest8:
./crashme +256 666 10 3 4
ptest9:
./crashme +256 666 100 3 4
ptest10:
./crashme +4096 666 100 00:00:05 4
ptest11:
./crashme +4096 666 250 00:03:00 4
# here are some tests taken from the BAT files done for windows.
test1: test1a test1b test1c
test1a:
mkdir -p $(LOG_DIR)
./pddet -examine 16
./pddet -examine 16 > $(LOG_DIR)/pddet.log
test1b:
sh -c "CRASHPRNG=MT;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_mt.log
sh -c "CRASHPRNG=RAND;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_rand.log
sh -c "CRASHPRNG=VNSQ;export CRASHPRNG;./crashme -64 666 5 -15 3" > $(LOG_DIR)/crashme-prng_vnsq.log
test1c: test1ca test1cb test1cc
test1ca:
sh -c "CRASHPRNG=MT;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-mt.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3"
test1cb:
sh -c "CRASHPRNG=RAND;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-rand.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3"
test1cc:
sh -c "CRASHPRNG=VNSQ;export CRASHPRNG;CRASHLOG=$(LOG_DIR)/crashme-test1-vnsq.log;export CRASHLOG;./crashme 8192 666 100 00:00:30 3"
test-mt19937ar: mt19937ar_main
./mt19937ar_main
mt19937ar_main: mt19937ar.c
$(CC) $(CCFLAGS) -DMT19937AR_MAIN -o mt19937ar_main mt19937ar.c
### Use these targets to disable all crash report generation,
### otherwise large amounts of system resources could be consumed.
### These targets are for Apple Mac.
report-crash-stop:
-launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
-sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist
report-crash-start:
-launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
-sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist
### These commands work in some linux environments.
### An alternative would configuration of ~/.apport-ignore.xml or /etc/apport
### to tell apport to ignore crashme. But that still that leaves
### /proc/sys/kernel/core_pattern
### sending a large number of crash dumps to apport.
APPORT_INIT=/etc/init.d/apport
CORE_PATTERN_API=/proc/sys/kernel/core_pattern
CORE_PATTERN=core-%p-%u-%g-%s-%t-%h-%e
apport-crash-stop:
sudo $(APPORT_INIT) stop
cat $(CORE_PATTERN_API)
apport-crash-start:
sudo $(APPORT_INIT) start
cat $(CORE_PATTERN_API)
set-core-pattern:
sudo sh -c 'echo $(CORE_PATTERN) > $(CORE_PATTERN_API)'
cat $(CORE_PATTERN_API)
show-core-limit:
bash -c "ulimit -a"
#
ps:
-ps -C crashme -f -H
pgrep:
-pgrep -l crashme
pkill:
-pkill crashme
|