@@ -276,6 +276,8 @@ static void monitor_throw(PyThreadState *tstate,
276276
277277static int check_args_iterable (PyThreadState * , PyObject * func , PyObject * vararg );
278278static int get_exception_handler (PyCodeObject * , int , int * , int * , int * );
279+ static void dtrace_function_entry (_PyInterpreterFrame * );
280+ static void dtrace_function_return (_PyInterpreterFrame * );
279281static _PyInterpreterFrame *
280282_PyEvalFramePushAndInit_Ex (PyThreadState * tstate , _PyStackRef func ,
281283 PyObject * locals , Py_ssize_t nargs , PyObject * callargs , PyObject * kwargs , _PyInterpreterFrame * previous );
@@ -814,9 +816,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
814816 _Py_Instrument (_PyFrame_GetCode (frame ), tstate -> interp );
815817 monitor_throw (tstate , frame , frame -> instr_ptr );
816818 /* TO DO -- Monitor throw entry. */
819+ DTRACE_FUNCTION_ENTRY ();
817820 goto resume_with_error ;
818821 }
819-
820822 /* Local "register" variables.
821823 * These are cached values from the frame and code object. */
822824 _Py_CODEUNIT * next_instr ;
@@ -834,6 +836,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
834836 }
835837
836838 next_instr = frame -> instr_ptr ;
839+ DTRACE_FUNCTION_ENTRY ();
837840resume_frame :
838841 stack_pointer = _PyFrame_GetStackPointer (frame );
839842
@@ -3062,6 +3065,37 @@ PyUnstable_Eval_RequestCodeExtraIndex(freefunc free)
30623065 return new_index ;
30633066}
30643067
3068+
3069+ static void
3070+ dtrace_function_entry (_PyInterpreterFrame * frame )
3071+ {
3072+ const char * filename ;
3073+ const char * funcname ;
3074+ int lineno ;
3075+
3076+ PyCodeObject * code = _PyFrame_GetCode (frame );
3077+ filename = PyUnicode_AsUTF8 (code -> co_filename );
3078+ funcname = PyUnicode_AsUTF8 (code -> co_name );
3079+ lineno = PyUnstable_InterpreterFrame_GetLine (frame );
3080+
3081+ PyDTrace_FUNCTION_ENTRY (filename , funcname , lineno );
3082+ }
3083+
3084+ static void
3085+ dtrace_function_return (_PyInterpreterFrame * frame )
3086+ {
3087+ const char * filename ;
3088+ const char * funcname ;
3089+ int lineno ;
3090+
3091+ PyCodeObject * code = _PyFrame_GetCode (frame );
3092+ filename = PyUnicode_AsUTF8 (code -> co_filename );
3093+ funcname = PyUnicode_AsUTF8 (code -> co_name );
3094+ lineno = PyUnstable_InterpreterFrame_GetLine (frame );
3095+
3096+ PyDTrace_FUNCTION_RETURN (filename , funcname , lineno );
3097+ }
3098+
30653099/* Implement Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as functions
30663100 for the limited API. */
30673101
0 commit comments