114 std::cout << std::flush;
116 Py_TYPE(self)->tp_free((PyObject*)self);
120 static PyObject* PathConstraint_getBranchConstraints(PyObject* self, PyObject* noarg) {
122 PyObject* ret =
nullptr;
126 for (
triton::usize index = 0; index != branches.size(); index++) {
128 xPyDict_SetItem(dict, PyStr_FromString(
"isTaken"), PyBool_FromLong(std::get<0>(branches[index])));
132 PyList_SetItem(ret, index, dict);
138 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
143 static PyObject* PathConstraint_getComment(PyObject* self, PyObject* noarg) {
148 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
153 static PyObject* PathConstraint_getSourceAddress(PyObject* self, PyObject* noarg) {
158 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
163 static PyObject* PathConstraint_getTakenAddress(PyObject* self, PyObject* noarg) {
168 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
173 static PyObject* PathConstraint_getTakenPredicate(PyObject* self, PyObject* noarg) {
178 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
183 static PyObject* PathConstraint_getThreadId(PyObject* self, PyObject* noarg) {
188 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
193 static PyObject* PathConstraint_isMultipleBranches(PyObject* self, PyObject* noarg) {
200 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
205 static PyObject* PathConstraint_setComment(PyObject* self, PyObject* comment) {
207 if (!PyStr_Check(comment))
208 return PyErr_Format(PyExc_TypeError,
"PathConstraint::setComment(): Expected a string as argument.");
214 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
221 {
"getBranchConstraints", PathConstraint_getBranchConstraints, METH_NOARGS,
""},
222 {
"getComment", PathConstraint_getComment, METH_NOARGS,
""},
223 {
"getSourceAddress", PathConstraint_getSourceAddress, METH_NOARGS,
""},
224 {
"getTakenAddress", PathConstraint_getTakenAddress, METH_NOARGS,
""},
225 {
"getTakenPredicate", PathConstraint_getTakenPredicate, METH_NOARGS,
""},
226 {
"getThreadId", PathConstraint_getThreadId, METH_NOARGS,
""},
227 {
"isMultipleBranches", PathConstraint_isMultipleBranches, METH_NOARGS,
""},
228 {
"setComment", PathConstraint_setComment, METH_O,
""},
229 {
nullptr,
nullptr, 0,
nullptr}
234 PyVarObject_HEAD_INIT(&PyType_Type, 0)
254 "PathConstraint objects",
303 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)