components/python/python34/patches/00-dtrace.patch
branchs11-update
changeset 3786 fa9d2da4d216
parent 3779 d01825f968e9
child 3869 eb4c6284602f
equal deleted inserted replaced
3785:6a3f91179f05 3786:fa9d2da4d216
  1009 +    run_unittest(DTraceTestsOptimize)
  1009 +    run_unittest(DTraceTestsOptimize)
  1010 +
  1010 +
  1011 +if __name__ == '__main__':
  1011 +if __name__ == '__main__':
  1012 +    test_main()
  1012 +    test_main()
  1013 +
  1013 +
  1014 --- Python-3.4.1/Lib/test/test_sys.py.~1~	2014-05-18 22:19:38.000000000 -0700
  1014 --- Python-3.4.2/Lib/test/test_sys.py.~1~	2014-09-22 05:57:02.000000000 -0700
  1015 +++ Python-3.4.1/Lib/test/test_sys.py	2014-05-27 10:34:04.212950775 -0700
  1015 +++ Python-3.4.2/Lib/test/test_sys.py	2014-09-22 11:46:06.131047596 -0700
  1016 @@ -728,6 +728,7 @@
  1016 @@ -729,6 +729,7 @@
  1017          self.assertEqual(sys.getsizeof(True, -1), size('') + self.longdigit)
  1017          self.assertEqual(sys.getsizeof(True, -1), size('') + self.longdigit)
  1018  
  1018  
  1019      def test_objecttypes(self):
  1019      def test_objecttypes(self):
  1020 +        import dtrace
  1020 +        import dtrace
  1021          # check all types defined in Objects/
  1021          # check all types defined in Objects/
  1022          size = test.support.calcobjsize
  1022          size = test.support.calcobjsize
  1023          vsize = test.support.calcvobjsize
  1023          vsize = test.support.calcvobjsize
  1024 @@ -753,13 +754,17 @@
  1024 @@ -754,13 +755,17 @@
  1025              return inner
  1025              return inner
  1026          check(get_cell().__closure__[0], size('P'))
  1026          check(get_cell().__closure__[0], size('P'))
  1027          # code
  1027          # code
  1028 -        check(get_cell().__code__, size('5i9Pi3P'))
  1028 -        check(get_cell().__code__, size('5i9Pi3P'))
  1029 -        check(get_cell.__code__, size('5i9Pi3P'))
  1029 -        check(get_cell.__code__, size('5i9Pi3P'))
  1040 -        check(get_cell2.__code__, size('5i9Pi3P') + 1)
  1040 -        check(get_cell2.__code__, size('5i9Pi3P') + 1)
  1041 +        check(get_cell2.__code__, size(code) + 1)
  1041 +        check(get_cell2.__code__, size(code) + 1)
  1042          # complex
  1042          # complex
  1043          check(complex(0,1), size('2d'))
  1043          check(complex(0,1), size('2d'))
  1044          # method_descriptor (descriptor object)
  1044          # method_descriptor (descriptor object)
  1045 --- Python-3.4.1/Makefile.pre.in.~1~	2014-05-18 22:19:39.000000000 -0700
  1045 --- Python-3.4.2/Makefile.pre.in.~1~	2014-09-22 05:57:02.000000000 -0700
  1046 +++ Python-3.4.1/Makefile.pre.in	2014-05-27 10:34:04.213739956 -0700
  1046 +++ Python-3.4.2/Makefile.pre.in	2014-09-22 11:47:52.199531636 -0700
  1047 @@ -52,6 +52,13 @@
  1047 @@ -52,6 +52,13 @@
  1048  # Use this to make a link between python$(VERSION) and python in $(BINDIR)
  1048  # Use this to make a link between python$(VERSION) and python in $(BINDIR)
  1049  LN=		@LN@
  1049  LN=		@LN@
  1050  
  1050  
  1051 +DTRACE=         @DTRACE@
  1051 +DTRACE=         @DTRACE@
  1056 +
  1056 +
  1057 +
  1057 +
  1058  # Portable install script (configure doesn't always guess right)
  1058  # Portable install script (configure doesn't always guess right)
  1059  INSTALL=	@INSTALL@
  1059  INSTALL=	@INSTALL@
  1060  INSTALL_PROGRAM=@INSTALL_PROGRAM@
  1060  INSTALL_PROGRAM=@INSTALL_PROGRAM@
  1061 @@ -569,7 +576,7 @@
  1061 @@ -584,7 +591,7 @@
  1062  	$(AR) $(ARFLAGS) $@ $(MODOBJS)
  1062  	$(AR) $(ARFLAGS) $@ $(MODOBJS)
  1063  	$(RANLIB) $@
  1063  	$(RANLIB) $@
  1064  
  1064  
  1065 -libpython$(LDVERSION).so: $(LIBRARY_OBJS)
  1065 -libpython$(LDVERSION).so: $(LIBRARY_OBJS)
  1066 +libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACEOBJS)
  1066 +libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACEOBJS)
  1067  	if test $(INSTSONAME) != $(LDLIBRARY); then \
  1067  	if test $(INSTSONAME) != $(LDLIBRARY); then \
  1068  		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  1068  		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  1069  		$(LN) -f $(INSTSONAME) $@; \
  1069  		$(LN) -f $(INSTSONAME) $@; \
  1070 @@ -580,9 +587,8 @@
  1070 @@ -595,9 +602,8 @@
  1071  libpython3.so:	libpython$(LDVERSION).so
  1071  libpython3.so:	libpython$(LDVERSION).so
  1072  	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
  1072  	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
  1073  
  1073  
  1074 -libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
  1074 -libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
  1075 -	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  1075 -	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  1077 +libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) $(DTRACEOBJS)
  1077 +libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) $(DTRACEOBJS)
  1078 +	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACEOBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
  1078 +	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACEOBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
  1079  
  1079  
  1080  libpython$(VERSION).sl: $(LIBRARY_OBJS)
  1080  libpython$(VERSION).sl: $(LIBRARY_OBJS)
  1081  	$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
  1081  	$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
  1082 @@ -682,12 +688,18 @@
  1082 @@ -697,12 +703,18 @@
  1083  		$(MODULE_OBJS) \
  1083  		$(MODULE_OBJS) \
  1084  		$(SIGNAL_OBJS) \
  1084  		$(SIGNAL_OBJS) \
  1085  		$(MODOBJS) \
  1085  		$(MODOBJS) \
  1086 +		$(DTRACEOBJS) \
  1086 +		$(DTRACEOBJS) \
  1087  		$(srcdir)/Modules/getbuildinfo.c
  1087  		$(srcdir)/Modules/getbuildinfo.c
  1096 +		mv [email protected] $@ ; \
  1096 +		mv [email protected] $@ ; \
  1097 +	fi;
  1097 +	fi;
  1098  
  1098  
  1099  Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
  1099  Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
  1100  	$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
  1100  	$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
  1101 @@ -820,6 +832,46 @@
  1101 @@ -835,6 +847,46 @@
  1102  Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
  1102  Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
  1103  	$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
  1103  	$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
  1104  
  1104  
  1105 +$(srcdir)/Include/pydtrace.h: $(srcdir)/Include/pydtrace.d
  1105 +$(srcdir)/Include/pydtrace.h: $(srcdir)/Include/pydtrace.d
  1106 +	if test "$(DTRACE)" != "" ; then \
  1106 +	if test "$(DTRACE)" != "" ; then \
  1143 +	fi;
  1143 +	fi;
  1144 +
  1144 +
  1145  ############################################################################
  1145  ############################################################################
  1146  # Header files
  1146  # Header files
  1147  
  1147  
  1148 @@ -1516,6 +1568,11 @@
  1148 @@ -1531,6 +1583,11 @@
  1149  	find build -name '*.py[co]' -exec rm -f {} ';' || true
  1149  	find build -name '*.py[co]' -exec rm -f {} ';' || true
  1150  	-rm -f pybuilddir.txt
  1150  	-rm -f pybuilddir.txt
  1151  	-rm -f Lib/lib2to3/*Grammar*.pickle
  1151  	-rm -f Lib/lib2to3/*Grammar*.pickle
  1152 +	rm -f Include/pydtrace.h
  1152 +	rm -f Include/pydtrace.h
  1153 +	rm -f Include/pydtrace_offsets Include/pydtrace_offsets.h
  1153 +	rm -f Include/pydtrace_offsets Include/pydtrace_offsets.h
  1155 +	rm -f Modules/gcmodule.o.ts_dtrace
  1155 +	rm -f Modules/gcmodule.o.ts_dtrace
  1156 +	rm -f Objects/typeobject.o.ts_dtrace
  1156 +	rm -f Objects/typeobject.o.ts_dtrace
  1157  	-rm -f Modules/_testembed Modules/_freeze_importlib
  1157  	-rm -f Modules/_testembed Modules/_freeze_importlib
  1158  
  1158  
  1159  profile-removal:
  1159  profile-removal:
  1160 @@ -1547,6 +1604,11 @@
  1160 @@ -1562,6 +1619,11 @@
  1161  				     -o -name '*.orig' -o -name '*.rej' \
  1161  				     -o -name '*.orig' -o -name '*.rej' \
  1162  				     -o -name '*.bak' ')' \
  1162  				     -o -name '*.bak' ')' \
  1163  				     -exec rm -f {} ';'
  1163  				     -exec rm -f {} ';'
  1164 +	rm -f Include/pydtrace.h
  1164 +	rm -f Include/pydtrace.h
  1165 +	rm -f Include/pydtrace_offsets Include/pydtrace_offsets.h
  1165 +	rm -f Include/pydtrace_offsets Include/pydtrace_offsets.h
  1478 +(PyObject *self)
  1478 +(PyObject *self)
  1479 +{
  1479 +{
  1480      PyTypeObject *type, *base;
  1480      PyTypeObject *type, *base;
  1481      destructor basedealloc;
  1481      destructor basedealloc;
  1482      PyThreadState *tstate = PyThreadState_GET();
  1482      PyThreadState *tstate = PyThreadState_GET();
  1483 --- Python-3.4.0/Python/ceval.c
  1483 --- Python-3.4.2/Python/ceval.c.~1~	2014-09-22 05:57:05.000000000 -0700
  1484 +++ Python-3.4.0/Python/ceval.c
  1484 +++ Python-3.4.2/Python/ceval.c	2014-09-22 11:50:27.740913482 -0700
  1485 @@ -18,6 +18,13 @@
  1485 @@ -18,6 +18,13 @@
  1486  
  1486  
  1487  #include <ctype.h>
  1487  #include <ctype.h>
  1488  
  1488  
  1489 +#ifdef WITH_DTRACE
  1489 +#ifdef WITH_DTRACE
  1604 +#endif
  1604 +#endif
  1605 +
  1605 +
  1606      co = f->f_code;
  1606      co = f->f_code;
  1607      names = co->co_names;
  1607      names = co->co_names;
  1608      consts = co->co_consts;
  1608      consts = co->co_consts;
  1609 @@ -1343,6 +1412,12 @@
  1609 @@ -1350,6 +1419,12 @@
  1610          /* Main switch on opcode */
  1610          /* Main switch on opcode */
  1611          READ_TIMESTAMP(inst0);
  1611          READ_TIMESTAMP(inst0);
  1612  
  1612  
  1613 +#ifdef WITH_DTRACE
  1613 +#ifdef WITH_DTRACE
  1614 +        if (PYTHON_LINE_ENABLED()) {
  1614 +        if (PYTHON_LINE_ENABLED()) {
  1617 +#endif
  1617 +#endif
  1618 +
  1618 +
  1619          switch (opcode) {
  1619          switch (opcode) {
  1620  
  1620  
  1621          /* BEWARE!
  1621          /* BEWARE!
  1622 @@ -3216,6 +3291,10 @@
  1622 @@ -3223,6 +3298,10 @@
  1623  
  1623  
  1624      /* pop frame */
  1624      /* pop frame */
  1625  exit_eval_frame:
  1625  exit_eval_frame:
  1626 +#ifdef WITH_DTRACE
  1626 +#ifdef WITH_DTRACE
  1627 +    if (PYTHON_FUNCTION_RETURN_ENABLED())
  1627 +    if (PYTHON_FUNCTION_RETURN_ENABLED())
  1628 +        dtrace_return(f);
  1628 +        dtrace_return(f);
  1629 +#endif
  1629 +#endif
  1630      Py_LeaveRecursiveCall();
  1630      Py_LeaveRecursiveCall();
  1631      f->f_executing = 0;
  1631      f->f_executing = 0;
  1632      tstate->frame = f->f_back;
  1632      tstate->frame = f->f_back;
  1633 @@ -3915,6 +3994,57 @@
  1633 @@ -3922,6 +4001,57 @@
  1634      return result;
  1634      return result;
  1635  }
  1635  }
  1636  
  1636  
  1637 +/*
  1637 +/*
  1638 + * These shenanigans look like utter madness, but what we're actually doing is
  1638 + * These shenanigans look like utter madness, but what we're actually doing is
  1686 +
  1686 +
  1687 +
  1687 +
  1688  PyObject *
  1688  PyObject *
  1689  _PyEval_CallTracing(PyObject *func, PyObject *args)
  1689  _PyEval_CallTracing(PyObject *func, PyObject *args)
  1690  {
  1690  {
  1691 @@ -3932,6 +4062,51 @@
  1691 @@ -3939,6 +4069,51 @@
  1692      return result;
  1692      return result;
  1693  }
  1693  }
  1694  
  1694  
  1695 +#ifdef WITH_DTRACE
  1695 +#ifdef WITH_DTRACE
  1696 +/* See Objects/lnotab_notes.txt for a description of how tracing works. */
  1696 +/* See Objects/lnotab_notes.txt for a description of how tracing works. */
  1738 +#endif
  1738 +#endif
  1739 +
  1739 +
  1740  /* See Objects/lnotab_notes.txt for a description of how tracing works. */
  1740  /* See Objects/lnotab_notes.txt for a description of how tracing works. */
  1741  static int
  1741  static int
  1742  maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
  1742  maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
  1743 --- Python-3.4.0/configure
  1743 --- Python-3.4.2/configure.~1~	2014-09-22 05:57:05.000000000 -0700
  1744 +++ Python-3.4.0/configure
  1744 +++ Python-3.4.2/configure	2014-09-22 12:48:32.849088475 -0700
  1745 @@ -642,6 +642,11 @@
  1745 @@ -642,6 +642,11 @@
  1746  MACHDEP_OBJS
  1746  MACHDEP_OBJS
  1747  DYNLOADFILE
  1747  DYNLOADFILE
  1748  DLINCLDIR
  1748  DLINCLDIR
  1749 +DTRACEOBJS
  1749 +DTRACEOBJS
  1752 +DFLAGS
  1752 +DFLAGS
  1753 +DTRACE
  1753 +DTRACE
  1754  THREADOBJ
  1754  THREADOBJ
  1755  LDLAST
  1755  LDLAST
  1756  USE_THREAD_MODULE
  1756  USE_THREAD_MODULE
  1757 @@ -811,6 +816,7 @@
  1757 @@ -812,6 +817,7 @@
  1758  with_tsc
  1758  with_tsc
  1759  with_pymalloc
  1759  with_pymalloc
  1760  with_valgrind
  1760  with_valgrind
  1761 +with_dtrace
  1761 +with_dtrace
  1762  with_fpectl
  1762  with_fpectl
  1763  with_libm
  1763  with_libm
  1764  with_libc
  1764  with_libc
  1765 @@ -1494,6 +1500,7 @@
  1765 @@ -1495,6 +1501,7 @@
  1766    --with(out)-tsc         enable/disable timestamp counter profile
  1766    --with(out)-tsc         enable/disable timestamp counter profile
  1767    --with(out)-pymalloc    disable/enable specialized mallocs
  1767    --with(out)-pymalloc    disable/enable specialized mallocs
  1768    --with-valgrind         Enable Valgrind support
  1768    --with-valgrind         Enable Valgrind support
  1769 +  --with(out)-dtrace      disable/enable dtrace support
  1769 +  --with(out)-dtrace      disable/enable dtrace support
  1770    --with-fpectl           enable SIGFPE catching
  1770    --with-fpectl           enable SIGFPE catching
  1771    --with-libm=STRING      math library
  1771    --with-libm=STRING      math library
  1772    --with-libc=STRING      C library
  1772    --with-libc=STRING      C library
  1773 @@ -10368,6 +10375,174 @@
  1773 @@ -10386,6 +10393,174 @@
  1774      OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
  1774      OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
  1775  fi
  1775  fi
  1776  
  1776  
  1777 +# Check for dtrace support
  1777 +# Check for dtrace support
  1778 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dtrace" >&5
  1778 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dtrace" >&5
  1943 +
  1943 +
  1944 +
  1944 +
  1945  # -I${DLINCLDIR} is added to the compile rule for importdl.o
  1945  # -I${DLINCLDIR} is added to the compile rule for importdl.o
  1946  
  1946  
  1947  DLINCLDIR=.
  1947  DLINCLDIR=.
  1948 --- Python-3.4.1/configure.ac.~1~	2014-05-18 22:19:40.000000000 -0700
  1948 --- Python-3.4.2/configure.ac.~1~	2014-09-22 05:57:05.000000000 -0700
  1949 +++ Python-3.4.1/configure.ac	2014-05-27 10:34:04.224755986 -0700
  1949 +++ Python-3.4.2/configure.ac	2014-09-22 12:51:15.173895356 -0700
  1950 @@ -2857,6 +2857,62 @@
  1950 @@ -2874,6 +2874,62 @@
  1951      OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
  1951      OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
  1952  fi
  1952  fi
  1953  
  1953  
  1954 +# Check for dtrace support
  1954 +# Check for dtrace support
  1955 +AC_MSG_CHECKING(for --with-dtrace)
  1955 +AC_MSG_CHECKING(for --with-dtrace)
  2020 +#undef WITH_DTRACE
  2020 +#undef WITH_DTRACE
  2021 +
  2021 +
  2022  /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic
  2022  /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic
  2023     linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).
  2023     linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).
  2024     Dyld is necessary to support frameworks. */
  2024     Dyld is necessary to support frameworks. */
  2025 --- Python-3.4.0/setup.py
  2025 --- Python-3.4.2/setup.py.~1~	2014-09-22 05:57:05.000000000 -0700
  2026 +++ Python-3.4.0/setup.py
  2026 +++ Python-3.4.2/setup.py	2014-09-22 12:56:08.602474892 -0700
  2027 @@ -637,6 +637,9 @@
  2027 @@ -643,6 +643,9 @@
  2028          # syslog daemon interface
  2028          # syslog daemon interface
  2029          exts.append( Extension('syslog', ['syslogmodule.c']) )
  2029          exts.append( Extension('syslog', ['syslogmodule.c']) )
  2030  
  2030  
  2031 +        # jcea DTRACE probes
  2031 +        # jcea DTRACE probes
  2032 +        exts.append( Extension('dtrace', ['dtracemodule.c']) )
  2032 +        exts.append( Extension('dtrace', ['dtracemodule.c']) )