summaryrefslogtreecommitdiff
path: root/coverage/ctracer/datastack.h
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-01 10:05:22 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-01 10:05:22 -0400
commit3ca81249fd940ba054338317c3aaaa776bc88593 (patch)
treecc8017296632a81fbd409564e372780efe230193 /coverage/ctracer/datastack.h
parent12d1d340283d6e2bc94bc3ad2d512380192710ac (diff)
downloadpython-coveragepy-git-3ca81249fd940ba054338317c3aaaa776bc88593.tar.gz
Split tracer.c into smaller files
Diffstat (limited to 'coverage/ctracer/datastack.h')
-rw-r--r--coverage/ctracer/datastack.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/coverage/ctracer/datastack.h b/coverage/ctracer/datastack.h
new file mode 100644
index 00000000..78f85f7e
--- /dev/null
+++ b/coverage/ctracer/datastack.h
@@ -0,0 +1,45 @@
+/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */
+/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */
+
+#ifndef _COVERAGE_DATASTACK_H
+#define _COVERAGE_DATASTACK_H
+
+#include "util.h"
+#include "stats.h"
+
+/* An entry on the data stack. For each call frame, we need to record all
+ * the information needed for CTracer_handle_line to operate as quickly as
+ * possible. All PyObject* here are borrowed references.
+ */
+typedef struct DataStackEntry {
+ /* The current file_data dictionary. Borrowed, owned by self->data. */
+ PyObject * file_data;
+
+ /* The disposition object for this frame. If collector.py and control.py
+ * are working properly, this will be an instance of CFileDisposition.
+ */
+ PyObject * disposition;
+
+ /* The FileTracer handling this frame, or None if it's Python. */
+ PyObject * file_tracer;
+
+ /* The line number of the last line recorded, for tracing arcs.
+ -1 means there was no previous line, as when entering a code object.
+ */
+ int last_line;
+} DataStackEntry;
+
+/* A data stack is a dynamically allocated vector of DataStackEntry's. */
+typedef struct DataStack {
+ int depth; /* The index of the last-used entry in stack. */
+ int alloc; /* number of entries allocated at stack. */
+ /* The file data at each level, or NULL if not recording. */
+ DataStackEntry * stack;
+} DataStack;
+
+
+int DataStack_init(Stats * pstats, DataStack *pdata_stack);
+void DataStack_dealloc(Stats * pstats, DataStack *pdata_stack);
+int DataStack_grow(Stats * pstats, DataStack *pdata_stack);
+
+#endif /* _COVERAGE_DATASTACK_H */