|
From: David B. <dav...@us...> - 2004-11-28 21:34:48
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv669 Modified Files: Tag: sidewinder-branch langpython.c Log Message: hooking the profile code Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.21 retrieving revision 1.2.4.22 diff -C2 -d -r1.2.4.21 -r1.2.4.22 *** langpython.c 28 Nov 2004 20:45:18 -0000 1.2.4.21 --- langpython.c 28 Nov 2004 21:34:30 -0000 1.2.4.22 *************** *** 62,65 **** --- 62,67 ---- #undef _DEBUG /*otherwise debug build of Frontier requires debug build of python dll*/ #include <Python.h> + #include <compile.h> + #include <frameobject.h> #elif defined(MACVERSION) *************** *** 70,73 **** --- 72,77 ---- #include <Python/Python.h> + #include <Python/compile.h> + #include <Python/frameobject.h> #elif TARGET_RT_MAC_CFM *************** *** 222,225 **** --- 226,230 ---- void (*ptr_PyEval_RestoreThread) (PyThreadState *); PyThreadState * (*ptr_PyEval_SaveThread) (void); + void (*ptr_PyEval_SetProfile) (Py_tracefunc, PyObject *); } py; *************** *** 325,328 **** --- 330,334 ---- #define PyEval_SaveThread (*py.ptr_PyEval_SaveThread) #define PyEval_RestoreThread (*py.ptr_PyEval_RestoreThread) + #define PyEval_SetProfile (*py.ptr_PyEval_SetProfile) static boolean importsymbol (typythonlib hm, char *symbol, void **ptraddress) { *************** *** 464,467 **** --- 470,474 ---- fl = fl && IMPORTSYMBOL (hm, PyEval_SaveThread); fl = fl && IMPORTSYMBOL (hm, PyEval_RestoreThread); + fl = fl && IMPORTSYMBOL (hm, PyEval_SetProfile); if (fl) { *************** *** 1618,1621 **** --- 1625,1634 ---- } + static int + checkstatus(PyObject *o, PyFrameObject *frame, int what, PyObject *arg) { + //printf("tick\n"); + return 0; + } + static boolean startInterpreter() { if (!ispythonloaded()) *************** *** 1633,1636 **** --- 1646,1651 ---- currentCookie = time(NULL); + PyEval_SetProfile(checkstatus, NULL); + releasepythonlock(); } |