forked from peadar/pstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.h
More file actions
33 lines (29 loc) · 1.03 KB
/
Copy pathpython.h
File metadata and controls
33 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <python2.7/Python.h>
#include <python2.7/frameobject.h>
#include <python2.7/longintrepr.h>
struct PythonPrinter;
typedef Elf::Addr (*python_printfunc)(const PyObject *pyo, const PyTypeObject *, PythonPrinter *pc, Elf::Addr);
struct PyPrinterEntry {
python_printfunc printer;
bool dupdetect;
PyPrinterEntry(python_printfunc, bool dupdetect);
};
struct PythonPrinter {
void addPrinter(const char *symbol, python_printfunc func, bool dupDetect);
void print(Elf::Addr remoteAddr);
std::map<Elf::Addr, PyTypeObject> types;
PythonPrinter(Process &proc_, std::ostream &os_, const PstackOptions &);
const char *prefix() const;
void printStacks();
Elf::Addr printThread(Elf::Addr);
Elf::Addr printInterp(Elf::Addr);
Process &proc;
std::ostream &os;
std::set<Elf::Addr> visited;
mutable int depth;
Elf::Addr interp_head;
const Process::LoadedObject *libPython;
std::map<Elf::Addr, PyPrinterEntry> printers;
PyPrinterEntry *heapPrinter;
const PstackOptions &options;
};