OLD | NEW |
1 /* C-based Tracer for Coverage. */ | 1 /* C-based Tracer for Coverage. */ |
2 | 2 |
3 #include "Python.h" | 3 #include "Python.h" |
4 #include "compile.h" /* in 2.3, this wasn't part of Python.h */ | 4 #include "compile.h" /* in 2.3, this wasn't part of Python.h */ |
5 #include "eval.h" /* or this. */ | 5 #include "eval.h" /* or this. */ |
6 #include "structmember.h" | 6 #include "structmember.h" |
7 #include "frameobject.h" | 7 #include "frameobject.h" |
8 | 8 |
9 /* Compile-time debugging helpers */ | 9 /* Compile-time debugging helpers */ |
10 #undef WHAT_LOG /* Define to log the WHAT params in the trace function.
*/ | 10 #undef WHAT_LOG /* Define to log the WHAT params in the trace function.
*/ |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 -1 means there was no previous line, as when entering a code object. | 97 -1 means there was no previous line, as when entering a code object. |
98 */ | 98 */ |
99 int last_line; | 99 int last_line; |
100 | 100 |
101 /* The parent frame for the last exception event, to fix missing returns. */ | 101 /* The parent frame for the last exception event, to fix missing returns. */ |
102 PyFrameObject * last_exc_back; | 102 PyFrameObject * last_exc_back; |
103 int last_exc_firstlineno; | 103 int last_exc_firstlineno; |
104 | 104 |
105 #if COLLECT_STATS | 105 #if COLLECT_STATS |
106 struct { | 106 struct { |
107 unsigned int calls; | 107 unsigned calls; |
108 unsigned int lines; | 108 unsigned lines; |
109 unsigned int returns; | 109 unsigned returns; |
110 unsigned int exceptions; | 110 unsigned exceptions; |
111 unsigned int others; | 111 unsigned others; |
112 unsigned int new_files; | 112 unsigned new_files; |
113 unsigned int missed_returns; | 113 unsigned missed_returns; |
114 unsigned int stack_reallocs; | 114 unsigned stack_reallocs; |
115 unsigned int errors; | 115 unsigned errors; |
116 } stats; | 116 } stats; |
117 #endif /* COLLECT_STATS */ | 117 #endif /* COLLECT_STATS */ |
118 } CTracer; | 118 } CTracer; |
119 | 119 |
120 #define STACK_DELTA 100 | 120 #define STACK_DELTA 100 |
121 | 121 |
122 static int | 122 static int |
123 CTracer_init(CTracer *self, PyObject *args_unused, PyObject *kwds_unused) | 123 CTracer_init(CTracer *self, PyObject *args_unused, PyObject *kwds_unused) |
124 { | 124 { |
125 #if COLLECT_STATS | 125 #if COLLECT_STATS |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 if (PyType_Ready(&CTracerType) < 0) { | 710 if (PyType_Ready(&CTracerType) < 0) { |
711 return; | 711 return; |
712 } | 712 } |
713 | 713 |
714 Py_INCREF(&CTracerType); | 714 Py_INCREF(&CTracerType); |
715 PyModule_AddObject(mod, "CTracer", (PyObject *)&CTracerType); | 715 PyModule_AddObject(mod, "CTracer", (PyObject *)&CTracerType); |
716 } | 716 } |
717 | 717 |
718 #endif /* Py3k */ | 718 #endif /* Py3k */ |
719 | 719 |
OLD | NEW |