111 std::cout << std::flush;
113 Py_TYPE(self)->tp_free((PyObject*)self);
117 static PyObject* PathConstraint_getBranchConstraints(PyObject* self, PyObject* noarg) {
119 PyObject* ret =
nullptr;
123 for (
triton::usize index = 0; index != branches.size(); index++) {
125 xPyDict_SetItem(dict, PyStr_FromString(
"isTaken"), PyBool_FromLong(std::get<0>(branches[index])));
129 PyList_SetItem(ret, index, dict);
135 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
140 static PyObject* PathConstraint_getComment(PyObject* self, PyObject* noarg) {
145 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
150 static PyObject* PathConstraint_getTakenAddress(PyObject* self, PyObject* noarg) {
155 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
160 static PyObject* PathConstraint_getTakenPredicate(PyObject* self, PyObject* noarg) {
165 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
170 static PyObject* PathConstraint_getThreadId(PyObject* self, PyObject* noarg) {
175 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
180 static PyObject* PathConstraint_isMultipleBranches(PyObject* self, PyObject* noarg) {
187 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
192 static PyObject* PathConstraint_setComment(PyObject* self, PyObject* comment) {
194 if (!PyStr_Check(comment))
195 return PyErr_Format(PyExc_TypeError,
"PathConstraint::setComment(): Expected a string as argument.");
201 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
208 {
"getBranchConstraints", PathConstraint_getBranchConstraints, METH_NOARGS,
""},
209 {
"getComment", PathConstraint_getComment, METH_NOARGS,
""},
210 {
"getTakenAddress", PathConstraint_getTakenAddress, METH_NOARGS,
""},
211 {
"getTakenPredicate", PathConstraint_getTakenPredicate, METH_NOARGS,
""},
212 {
"getThreadId", PathConstraint_getThreadId, METH_NOARGS,
""},
213 {
"isMultipleBranches", PathConstraint_isMultipleBranches, METH_NOARGS,
""},
214 {
"setComment", PathConstraint_setComment, METH_O,
""},
215 {
nullptr,
nullptr, 0,
nullptr}
220 PyVarObject_HEAD_INIT(&PyType_Type, 0)
240 "PathConstraint objects",
289 return (PyObject*)object;
The path constraint class.
The root class of all exceptions.
TRITON_EXPORT const char * what() const
Returns the exception message.
PyObject * PyPathConstraint(const triton::engines::symbolic::PathConstraint &pc)
Creates the PathConstraint python class.
PyTypeObject PathConstraint_Type
pyPathConstraint type.
PyObject * xPyList_New(Py_ssize_t len)
Creates a PyList and raises an exception if it fails.
int xPyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
Same as PyDict_SetItem but decrements reference on object and key.
PyObject * PyLong_FromUint64(triton::uint64 value)
Returns a pyObject from a triton::uint64.
PyObject * xPyDict_New(void)
Creates a PyDict and raises an exception if it fails.
PyObject * PyLong_FromUint32(triton::uint32 value)
Returns a pyObject from a triton::uint32.
PyObject * PyAstNode(const triton::ast::SharedAbstractNode &node)
Creates the AstNode python class.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
void PathConstraint_dealloc(PyObject *self)
PathConstraint destructor.
PyMethodDef PathConstraint_callbacks[]
PathConstraint methods.
#define PyPathConstraint_AsPathConstraint(v)