components/python/python27/patches/05-dtrace.patch
changeset 4698 4e27e549b58d
parent 3555 76f4672c5e4b
child 5183 3a048793fc91
equal deleted inserted replaced
4697:2be298b79293 4698:4e27e549b58d
    62      f->f_lasti = -1;
    62      f->f_lasti = -1;
    63 +    f->f_calllineno = code->co_firstlineno;
    63 +    f->f_calllineno = code->co_firstlineno;
    64      f->f_lineno = code->co_firstlineno;
    64      f->f_lineno = code->co_firstlineno;
    65      f->f_iblock = 0;
    65      f->f_iblock = 0;
    66  
    66  
    67 --- Python-2.7.9/Python/ceval.c.~1~	2014-12-10 07:59:58.000000000 -0800
    67 --- Python-2.7.10/Python/ceval.c.~1~	2015-05-10 10:17:06 -0800
    68 +++ Python-2.7.9/Python/ceval.c	2014-12-11 09:19:01.398584575 -0800
    68 +++ Python-2.7.10/Python/ceval.c	2015-05-18 14:31:31 -0800
    69 @@ -19,6 +19,11 @@
    69 @@ -19,6 +19,11 @@
    70  
    70  
    71  #include <ctype.h>
    71  #include <ctype.h>
    72  
    72  
    73 +#define HAVE_DTRACE
    73 +#define HAVE_DTRACE
    76 +#endif
    76 +#endif
    77 +
    77 +
    78  #ifndef WITH_TSC
    78  #ifndef WITH_TSC
    79  
    79  
    80  #define READ_TIMESTAMP(var)
    80  #define READ_TIMESTAMP(var)
    81 @@ -672,6 +677,55 @@
    81 @@ -674,6 +679,55 @@
    82                        NULL);
    82                        NULL);
    83  }
    83  }
    84  
    84  
    85 +#ifdef HAVE_DTRACE
    85 +#ifdef HAVE_DTRACE
    86 +static void
    86 +static void
   132 +#define	dtrace_return()
   132 +#define	dtrace_return()
   133 +#endif
   133 +#endif
   134  
   134  
   135  /* Interpreter main loop */
   135  /* Interpreter main loop */
   136  
   136  
   137 @@ -683,9 +737,84 @@
   137 @@ -685,9 +739,84 @@
   138      return PyEval_EvalFrameEx(f, 0);
   138      return PyEval_EvalFrameEx(f, 0);
   139  }
   139  }
   140  
   140  
   141 +/*
   141 +/*
   142 + * These shenanigans look like utter madness, but what we're actually doing is
   142 + * These shenanigans look like utter madness, but what we're actually doing is
   217 +#endif /* HAVE_DTRACE */
   217 +#endif /* HAVE_DTRACE */
   218 +
   218 +
   219  #ifdef DXPAIRS
   219  #ifdef DXPAIRS
   220      int lastopcode = 0;
   220      int lastopcode = 0;
   221  #endif
   221  #endif
   222 @@ -910,6 +1039,11 @@
   222 @@ -912,6 +1041,11 @@
   223          }
   223          }
   224      }
   224      }
   225  
   225  
   226 +#ifdef HAVE_DTRACE
   226 +#ifdef HAVE_DTRACE
   227 +    if (PYTHON_FUNCTION_ENTRY_ENABLED())
   227 +    if (PYTHON_FUNCTION_ENTRY_ENABLED())
   229 +#endif
   229 +#endif
   230 +
   230 +
   231      co = f->f_code;
   231      co = f->f_code;
   232      names = co->co_names;
   232      names = co->co_names;
   233      consts = co->co_consts;
   233      consts = co->co_consts;
   234 @@ -2673,6 +2807,9 @@
   234 @@ -2675,6 +2809,9 @@
   235              PyObject **sp;
   235              PyObject **sp;
   236              PCALL(PCALL_ALL);
   236              PCALL(PCALL_ALL);
   237              sp = stack_pointer;
   237              sp = stack_pointer;
   238 +#ifdef HAVE_DTRACE
   238 +#ifdef HAVE_DTRACE
   239 +            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
   239 +            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
   240 +#endif
   240 +#endif
   241  #ifdef WITH_TSC
   241  #ifdef WITH_TSC
   242              x = call_function(&sp, oparg, &intr0, &intr1);
   242              x = call_function(&sp, oparg, &intr0, &intr1);
   243  #else
   243  #else
   244 @@ -2714,6 +2851,9 @@
   244 @@ -2716,6 +2853,9 @@
   245              } else
   245              } else
   246                  Py_INCREF(func);
   246                  Py_INCREF(func);
   247              sp = stack_pointer;
   247              sp = stack_pointer;
   248 +#ifdef HAVE_DTRACE
   248 +#ifdef HAVE_DTRACE
   249 +            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
   249 +            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
   250 +#endif
   250 +#endif
   251              READ_TIMESTAMP(intr0);
   251              READ_TIMESTAMP(intr0);
   252              x = ext_do_call(func, &sp, flags, na, nk);
   252              x = ext_do_call(func, &sp, flags, na, nk);
   253              READ_TIMESTAMP(intr1);
   253              READ_TIMESTAMP(intr1);
   254 @@ -3014,6 +3154,10 @@
   254 @@ -3016,6 +3156,10 @@
   255  
   255  
   256      /* pop frame */
   256      /* pop frame */
   257  exit_eval_frame:
   257  exit_eval_frame:
   258 +#ifdef HAVE_DTRACE
   258 +#ifdef HAVE_DTRACE
   259 +    if (PYTHON_FUNCTION_RETURN_ENABLED())
   259 +    if (PYTHON_FUNCTION_RETURN_ENABLED())
   417 +#pragma D attributes Evolving/Evolving/Common provider python provider
   417 +#pragma D attributes Evolving/Evolving/Common provider python provider
   418 +#pragma D attributes Private/Private/Common provider python module
   418 +#pragma D attributes Private/Private/Common provider python module
   419 +#pragma D attributes Private/Private/Common provider python function
   419 +#pragma D attributes Private/Private/Common provider python function
   420 +#pragma D attributes Evolving/Evolving/Common provider python name
   420 +#pragma D attributes Evolving/Evolving/Common provider python name
   421 +#pragma D attributes Evolving/Evolving/Common provider python args
   421 +#pragma D attributes Evolving/Evolving/Common provider python args
   422 --- Python-2.7.9/Lib/test/test_sys.py.~1~	2014-12-10 07:59:47.000000000 -0800
   422 --- Python-2.7.10/Lib/test/test_sys.py.~1~	2015-05-10 10:17:04 -0800
   423 +++ Python-2.7.9/Lib/test/test_sys.py	2014-12-11 09:20:26.361157717 -0800
   423 +++ Python-2.7.10/Lib/test/test_sys.py	2015-05-18 14:35:06 -0800
   424 @@ -619,7 +619,7 @@
   424 @@ -620,7 +620,7 @@
   425          nfrees = len(x.f_code.co_freevars)
   425          nfrees = len(x.f_code.co_freevars)
   426          extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
   426          extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
   427                   ncells + nfrees - 1
   427                   ncells + nfrees - 1
   428 -        check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
   428 -        check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
   429 +        check(x, vsize('12P4i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
   429 +        check(x, vsize('12P4i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))