diff options
author | Łukasz Langa <lukasz@langa.pl> | 2016-09-10 00:37:37 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2016-09-10 00:37:37 (GMT) |
commit | a785c87d6eacbed81543a8afe3cb098fabb9610a (patch) | |
tree | ee127bbbef66a386f4c7f7a21d1e69a54eed5a52 /Makefile.pre.in | |
parent | 39b42ae8dbf81ee89dabf1c418c9081243b4ab97 (diff) | |
download | cpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.zip cpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.tar.gz cpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.tar.bz2 |
DTrace support: function calls, GC activity, line execution
Tested on macOS 10.11 dtrace, Ubuntu 16.04 SystemTap, and libbcc.
Largely based by an initial patch by Jesús Cea Avión, with some
influence from Dave Malcolm's SystemTap patch and Nikhil Benesch's
unification patch.
Things deliberately left out for simplicity:
- ustack helpers, I have no way of testing them at this point since
they are Solaris-specific
- PyFrameObject * in function__entry/function__return, this is
SystemTap-specific
- SPARC support
- dynamic tracing
- sys module dtrace facility introspection
All of those might be added later.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r-- | Makefile.pre.in | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in index 4445b24..908ca52 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -48,6 +48,10 @@ PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@ LLVM_PROF_MERGER=@LLVM_PROF_MERGER@ LLVM_PROF_FILE=@LLVM_PROF_FILE@ LLVM_PROF_ERR=@LLVM_PROF_ERR@ +DTRACE= @DTRACE@ +DFLAGS= @DFLAGS@ +DTRACE_HEADERS= @DTRACE_HEADERS@ +DTRACE_OBJS= @DTRACE_OBJS@ GNULD= @GNULD@ @@ -315,7 +319,7 @@ OPCODE_H_DIR= $(srcdir)/Include OPCODE_H_SCRIPT= $(srcdir)/Tools/scripts/generate_opcode_h.py OPCODE_H= $(OPCODE_H_DIR)/opcode.h OPCODE_H_GEN= $(PYTHON_FOR_GEN) $(OPCODE_H_SCRIPT) $(srcdir)/Lib/opcode.py $(OPCODE_H) -# + ########################################################################## # AST AST_H_DIR= Include @@ -391,7 +395,8 @@ PYTHON_OBJS= \ Python/$(DYNLOADFILE) \ $(LIBOBJS) \ $(MACHDEP_OBJS) \ - $(THREADOBJ) + $(THREADOBJ) \ + $(DTRACE_OBJS) ########################################################################## @@ -451,6 +456,15 @@ LIBRARY_OBJS= \ $(LIBRARY_OBJS_OMIT_FROZEN) \ Python/frozen.o +########################################################################## +# DTrace + +# On some systems, object files that reference DTrace probes need to be modified +# in-place by dtrace(1). +DTRACE_DEPS = \ + Python/ceval.o +# XXX: should gcmodule, etc. be here, too? + ######################################################################### # Rules @@ -852,6 +866,18 @@ Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h Python/frozen.o: Python/importlib.h Python/importlib_external.h +# Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to +# follow our naming conventions. dtrace(1) uses the output filename to generate +# an include guard, so we can't use a pipeline to transform its output. +Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d + $(DTRACE) $(DFLAGS) -o $@ -h -s $< + : sed in-place edit with POSIX-only tools + sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp + mv $@.tmp $@ + +Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS) + $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS) + Objects/typeobject.o: Objects/typeslots.inc Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py $(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc @@ -918,6 +944,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/pycapsule.h \ $(srcdir)/Include/pyctype.h \ $(srcdir)/Include/pydebug.h \ + $(srcdir)/Include/pydtrace.h \ $(srcdir)/Include/pyerrors.h \ $(srcdir)/Include/pyfpe.h \ $(srcdir)/Include/pyhash.h \ @@ -949,7 +976,8 @@ PYTHON_HEADERS= \ $(srcdir)/Include/weakrefobject.h \ pyconfig.h \ $(PARSER_HEADERS) \ - $(AST_H) + $(AST_H) \ + $(DTRACE_HEADERS) $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) @@ -1158,6 +1186,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ test/audiodata \ test/capath test/data \ test/cjkencodings test/decimaltestdata test/xmltestdata \ + test/dtracedata \ test/eintrdata \ test/imghdrdata \ test/libregrtest \ @@ -1569,6 +1598,7 @@ clean: pycremoval -rm -f Lib/lib2to3/*Grammar*.pickle -rm -f Programs/_testembed Programs/_freeze_importlib -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';' + -rm -f Include/pydtrace_probes.h profile-removal: find . -name '*.gc??' -exec rm -f {} ';' |