-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
386 lines (300 loc) · 10.7 KB
/
Makefile
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
WORKDIR = $(CURDIR)
PYTHON ?= python
RR_DIR ?= $(abspath ../rr)
OBJDIR = $(RR_DIR)/../obj
RR ?= "$(OBJDIR)/bin/rr"
SUNSPIDER ?= $(HOME)/src/SunSpider
# Current testing build made from gecko-dev git sha1
# e7567904cc0f161f1042d22333d690fd1f346896, hg commit ???
FF_SRCDIR = $(abspath ../mozilla-central)
#FF_OBJDIR = $(abspath ../ff-dbg)
#FF_OBJDIR = $(abspath ../ff-prof)
FF_OBJDIR = $(abspath ../ff-gcv)
XRE_PATH ?= $(FF_OBJDIR)/dist/bin
FF ?= "$(XRE_PATH)/firefox"
XPCSHELL = $(XRE_PATH)/xpcshell
TEST_LOG = $(WORKDIR)/[email protected]
DEBUG ?= -fm replay
RECORD ?= -fm record -b
REPLAY ?= -fm replay --autopilot
DBG ?= --debugger=$(RR) --debugger-args='$(RECORD)' --slowscript
DBG_RFTST ?= --debugger=$(RR) --debugger-args='$(RECORD)'
TRACE ?=
JS_ARGS =
LIBC_OBJDIR ?= $(HOME)/rpmbuild/BUILD/glibc-2.18/obj
PRELOAD_CUSTOM_LIBC ?= LD_PRELOAD="$(LIBC_OBJDIR)/libc.so:$(LIBC_OBJDIR)/nptl/libpthread.so:$(LD_PRELOAD)"
ifdef TEST_PATH
TEST_PATH_ARG = TEST_PATH="$(TEST_PATH)"
endif
##-----------------------------------------------------------------------------
## Targets to automate common tasks
PREFS = \
--setpref=javascript.options.ion.parallel_compilation=false
# PREFS = \
# --setpref=javascript.options.asmjs=false \
# --setpref=javascript.options.baselinejit.chrome=false \
# --setpref=javascript.options.baselinejit.content=false \
# --setpref=javascript.options.ion.chrome=false \
# --setpref=javascript.options.ion.content=false \
# --setpref=javascript.options.ion.parallel_compilation=false
# Shortcut for what you're currently working on, to save typing
default: clean record-bug-845190
#
# XXX this incantation records a trace of kernel scheduling decisions
#
# sudo make DBG="--debugger=perf --debugger-args='sched record -o /home/cjones/rr/workbench/sched.data /home/cjones/rr/rr/obj/bin/rr record --filter_lib=/home/cjones/rr/rr/obj/lib/librr_syscall_buffer.so'"
#
# Then to see the context switches,
#
# perf sched map
#
.PHONY: help
help::
@echo "Available targets are documented below. Common options:"
@echo " make DBG='[--debugger=program [--debugger-args=args]]' ..."
@echo " Use a test 'debugger' other than |rr record|, which"
@echo " is the default."
@echo " --or--"
@echo " make RECORD='recording-options' ..."
@echo " Adjust the arguments for recording that are passed to rr,"
@echo " without having to use the verbose DBG='' syntax above."
@echo
.PHONY: cycle
cycle: clean record-reftest replay
.PHONY: clean
help::
@echo " make clean"
@echo " Remove all trace directories."
clean:
rm -rf ~/.rr *.o /tmp/rr-test-*
.PHONY: debug
help::
@echo " make [TRACE=dir] debug"
@echo " Start a debug server for TRACE (default trace_0)."
debug:
$(RR) $(DEBUG) $(TRACE)
.PHONY: dif
help::
@echo " make dif"
@echo " Show a dif of the rr source dir.."
dif:
cd $(RR_DIR) && grep -rn '\/\*\* \*\/' src/* || git dif
.PHONY: record-firefox
help::
@echo " make [URL=url] record-firefox"
@echo " Record firefox running standalone, optionally loading URL."
record-firefox:
$(RR) $(RECORD) $(FF) -no-remote -P garbage $(URL)
.PHONY: record-mochitest
help::
@echo " make [TEST_PATH=dir] record-mochitest"
@echo " Record firefox running the mochitest suite, optionally"
@echo " just the TEST_PATH tests."
record-mochitest:
# The mochitest harness helpfully chdir()s to a tmp directory and then
# blows it away when the test suite finishes. This blows away our
# recorded trace as well. So explicitly save them to the workbench
# directory.
rm -f $(TEST_LOG)
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="$(DBG) $(PREFS)" \
$(TEST_PATH_ARG) \
mochitest-plain
strace-mochitest:
rm -f $(TEST_LOG)
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--debugger=strace --debugger-args=-f" \
$(TEST_PATH_ARG) mochitest-plain
.PHONY: record-mochitest-chrome
help::
@echo " make [TEST_PATH=dir] record-mochitest-chrome"
@echo " Record firefox running the mochitest-chrome suite,"
@echo " optionally just the TEST_PATH tests."
record-mochitest-chrome:
# The mochitest harness helpfully chdir()s to a tmp directory and then
# blows it away when the test suite finishes. This blows away our
# recorded trace as well. So explicitly save them to the workbench
# directory.
rm -f $(TEST_LOG)
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="$(DBG) $(PREFS)" \
$(TEST_PATH_ARG) \
mochitest-chrome
.PHONY: record-mochitest-a11y
help::
@echo " make [TEST_PATH=dir] record-mochitest-a11y"
@echo " Record firefox running the mochitest-a11y suite,"
@echo " optionally just the TEST_PATH tests."
record-mochitest-a11y:
# The mochitest harness helpfully chdir()s to a tmp directory and then
# blows it away when the test suite finishes. This blows away our
# recorded trace as well. So explicitly save them to the workbench
# directory.
rm -f $(TEST_LOG)
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="$(DBG) $(PREFS)" \
$(TEST_PATH_ARG) \
mochitest-a11y
.PHONY: record-crashtest
help::
@echo " make [TEST_PATH=dir] record-crashtest"
@echo " Record firefox running the crashtest suite, optionally"
@echo " just the TEST_PATH tests."
record-crashtest:
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--log-file=$(TEST_LOG) $(DBG_RFTST)" \
$(TEST_PATH_ARG) \
crashtest
.PHONY: record-crashtest-ipc
help::
@echo " make [TEST_PATH=dir] record-crashtest-ipc"
@echo " Record firefox running the crashtest-ipc suite, optionally"
@echo " just the TEST_PATH tests."
record-crashtest-ipc:
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--log-file=$(TEST_LOG) $(DBG_RFTST)" \
$(TEST_PATH_ARG) \
crashtest-ipc
.PHONY: record-reftest
help::
@echo " make [TEST_PATH=dir] record-reftest"
@echo " Record firefox running the reftest suite, optionally"
@echo " just the TEST_PATH tests."
record-reftest:
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--log-file=$(TEST_LOG) $(DBG_RFTST)" \
$(TEST_PATH_ARG) \
reftest
.PHONY: record-reftest-ipc
help::
@echo " make [TEST_PATH=dir] record-reftest"
@echo " Record firefox running the reftest-ipc suite, optionally"
@echo " just the TEST_PATH tests."
record-reftest-ipc:
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--log-file=$(TEST_LOG) $(DBG_RFTST)" \
$(TEST_PATH_ARG) \
reftest-ipc
.PHONY: record-jstestbrowser
help::
@echo "make [TEST_PATH=dir] record-jstestbrowser"
@echo " Record firefox running the jstestbrowser suite, optionally"
@echo " just the TEST_PATH tests."
record-jstestbrowser:
make -C $(FF_OBJDIR) \
EXTRA_TEST_ARGS="--log-file=$(TEST_LOG) $(DBG)" \
$(TEST_PATH_ARG) \
jstestbrowser
.PHONY: record-sunspider
help::
@echo " make [JS_ARGS=args] record-sunspider"
@echo " Record firefox jsshell running sunspider, optionally"
@echo " passing it JS_ARGS."
record-sunspider:
cd $(SUNSPIDER) && \
$(RR) $(RECORD) \
./sunspider --shell=$(XRE_PATH)/js \
--args="$(JS_ARGS)" \
--run=30 --suite=sunspider-0.9.1
.PHONY: sunspider
help::
@echo " make [JS_ARGS=args] sunspider"
@echo " Run sunspider under firefox jsshell optionally"
@echo " passing it JS_ARGS."
sunspider:
cd $(SUNSPIDER) && \
./sunspider --shell=$(XRE_PATH)/js \
--args="$(JS_ARGS)" \
--run=30 --suite=sunspider-0.9.1
.PHONY: replay
help::
@echo " make [TRACE=dir] replay"
@echo " Replay the recording TRACE (default trace_0) on autopilot."
replay:
$(RR) $(REPLAY) $(TRACE)
.PHONY: syscall-histogram
help::
@echo " make [TRACES=trace_dir...] syscall-histogram"
@echo " Build a histogram of unfiltered syscalls in local traces."
@echo " By default, all traces are counted. Specify TRACES to"
@echo " accumulate a different set."
TRACES ?= $(shell find . -maxdepth 1 -name 'trace_*')
syscall-histogram:
./syscall-histogram $(TRACES)
##-----------------------------------------------------------------------------
## Sundry helper programs
CFLAGS = -Wall -Werror -g -O0 -m32 -pthread
SIMPLE_PROGS = \
bad_syscall \
launch \
lcmp \
status2text \
strfutexcmd \
sysemu \
vdso_monkeypatch \
watchpoint
define SIMPLE_PROG_RULE # (1 = progname)
$(1): $(1).c
helper-progs:: Makefile $(1)
endef
$(foreach prog,$(SIMPLE_PROGS),$(eval $(call SIMPLE_PROG_RULE,$(prog))))
libseccomptrace.so: Makefile seccomptrace.c
$(CC) $(CFLAGS) -fPIC -shared -o $@ seccomptrace.c
regtrace: Makefile libseccomptrace.so regtrace.c
# XXX add me to rr tree?
librrmon.so: rrmon.o
$(CC) $(CFLAGS) -shared -o $@ $<
##-----------------------------------------------------------------------------
## LLVM plugin to instrument Bell-Larus path tracing
LLVM_PLUGIN_RELDIR = lib/Transforms/PathLogging
LLVM_SRCDIR = $(HOME)/src/llvm-clang/llvm
LLVM_OBJDIR = $(HOME)/src/llvm-clang/build
paths: Makefile PathLogging_plugin libpathlogging.so paths.c
clang -g -O2 -Xclang -load -Xclang $(WORKDIR)/PathLogging.so \
-pthread paths.c -o paths \
-Wl,-rpath -Wl,$(WORKDIR) -L $(WORKDIR) -lpathlogging
.PHONY: PathLogging_plugin
PathLogging_plugin:
touch $(LLVM_SRCDIR)/$(LLVM_PLUGIN_RELDIR)/PathLogging.cpp
make -C $(LLVM_OBJDIR)/$(LLVM_PLUGIN_RELDIR)
ln -fs $(LLVM_OBJDIR)/Release+Asserts/lib/PathLogging.so PathLogging.so
# XXX add me to rr tree
libpathlogging.so: Makefile path_logging.c
$(CC) -g $(CFLAGS) -I $(RR_DIR)/include -pthread -fPIC -shared \
-o $@ path_logging.c
mod: Makefile mod.cc
clang++ -g -O2 -Xclang -load -Xclang $(WORKDIR)/PathLogging.so \
-pthread -o $@ mod.cc \
-Wl,-rpath -Wl,$(WORKDIR) -L $(WORKDIR) -lpathlogging -ldl \
-Wl,--whole-archive $(FF_OBJDIR)/mozglue/build/libmozglue.a \
-Wl,--no-whole-archive -rdynamic -ldl
libctor.so: Makefile ctor.cc
clang++ -g -O2 -Xclang -load -Xclang $(WORKDIR)/PathLogging.so \
-pthread -fPIC -shared -o $@ ctor.cc \
-Wl,-rpath -Wl,$(WORKDIR) -L $(WORKDIR) -lpathlogging
##-----------------------------------------------------------------------------
## Temporariily obsolete code for running FF from nightly builds.
## This is no longer possible because Gecko has evolved beyond rr's
## capabilities.
##
# FF_DIR ?= .ff
# # XXX: sigh, no debug nightly builds. Nor symbolic links to "latest"
# # or something. So this is an arbitrarily-chosen, healthy-looking
# # build from 2013/06/20.
# FF_URL ?= http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux-debug/1371733138/
# #FF_URL ?= http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
# .PHONY: update-firefox
# help::
# @echo " make [FF_URL=url] update-firefox"
# @echo " Blow away the current firefox build and testsuite and"
# @echo " download the latest from FF_URL (defaulting to nightly"
# @echo " builds of trunk)."
# update-firefox:
# rm -rf $(FF_DIR)
# mkdir $(FF_DIR)
# cd $(FF_DIR) && \
# wget -nd -r -l 1 \
# -A 'firefox*linux-i686.tar.bz2,firefox*linux-i686*.tests.zip' \
# $(FF_URL) && \
# tar jxf firefox-*.tar.bz2 && \
# unzip -q firefox-*.zip