Skip to content

Commit 783b1f4

Browse files
committed
python bindings: expose more types to the module
see JonathanSalwan#1423
1 parent b5fb527 commit 783b1f4

1 file changed

Lines changed: 52 additions & 6 deletions

File tree

src/libtriton/bindings/python/modules/tritonCallbacks.cpp

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,60 @@ namespace triton {
230230
}
231231
}
232232

233+
static PyObject* triton_AstNode(PyObject* self, PyObject* args) {
234+
return PyErr_Format(PyExc_TypeError, "AstNode(): AstNode cannot be directly constructed. Use AstContext instead.");
235+
}
236+
237+
238+
static PyObject* triton_AstContext(PyObject* self, PyObject* args) {
239+
return PyErr_Format(PyExc_TypeError, "AstContext(): AstContext cannot be directly constructed. Use TritonContext.getAstContext() instead.");
240+
}
241+
242+
243+
static PyObject* triton_SymbolicExpression(PyObject* self, PyObject* args) {
244+
return PyErr_Format(PyExc_TypeError, "SymbolicExpression(): SymbolicExpression cannot be directly constructed.");
245+
}
246+
247+
248+
static PyObject* triton_SymbolicVariable(PyObject* self, PyObject* args) {
249+
return PyErr_Format(PyExc_TypeError, "SymbolicVariable(): SymbolicVariable cannot be directly constructed. Use TritonContext.newSymbolicVariable() instead.");
250+
}
251+
252+
253+
static PyObject* triton_PathConstraint(PyObject* self, PyObject* args) {
254+
return PyErr_Format(PyExc_TypeError, "PathConstraint(): PathConstraint cannot be directly constructed.");
255+
}
256+
257+
258+
static PyObject* triton_SolverModel(PyObject* self, PyObject* args) {
259+
return PyErr_Format(PyExc_TypeError, "SolverModel(): SolverModel cannot be directly constructed.");
260+
}
261+
262+
263+
static PyObject* triton_Register(PyObject* self, PyObject* args) {
264+
return PyErr_Format(PyExc_TypeError, "Register(): Register cannot be directly constructed. Use TritonContext.getRegister() instead.");
265+
}
266+
267+
268+
static PyObject* triton_BitsVector(PyObject* self, PyObject* args) {
269+
return PyErr_Format(PyExc_TypeError, "BitsVector(): BitsVector cannot be directly constructed.");
270+
}
233271

234272
PyMethodDef tritonCallbacks[] = {
235-
{"BasicBlock", (PyCFunction)triton_BasicBlock, METH_VARARGS, ""},
236-
{"Immediate", (PyCFunction)triton_Immediate, METH_VARARGS, ""},
237-
{"Instruction", (PyCFunction)triton_Instruction, METH_VARARGS, ""},
238-
{"MemoryAccess", (PyCFunction)triton_MemoryAccess, METH_VARARGS, ""},
239-
{"TritonContext", (PyCFunction)triton_TritonContext, METH_VARARGS, ""},
240-
{nullptr, nullptr, 0, nullptr}
273+
{"AstContext", (PyCFunction)triton_AstContext, METH_VARARGS, ""},
274+
{"AstNode", (PyCFunction)triton_AstNode, METH_VARARGS, ""},
275+
{"BasicBlock", (PyCFunction)triton_BasicBlock, METH_VARARGS, ""},
276+
{"BitsVector", (PyCFunction)triton_BitsVector, METH_VARARGS, ""},
277+
{"Immediate", (PyCFunction)triton_Immediate, METH_VARARGS, ""},
278+
{"Instruction", (PyCFunction)triton_Instruction, METH_VARARGS, ""},
279+
{"MemoryAccess", (PyCFunction)triton_MemoryAccess, METH_VARARGS, ""},
280+
{"PathConstraint", (PyCFunction)triton_PathConstraint, METH_VARARGS, ""},
281+
{"Register", (PyCFunction)triton_Register, METH_VARARGS, ""},
282+
{"SolverModel", (PyCFunction)triton_SolverModel, METH_VARARGS, ""},
283+
{"SymbolicExpression", (PyCFunction)triton_SymbolicExpression, METH_VARARGS, ""},
284+
{"SymbolicVariable", (PyCFunction)triton_SymbolicVariable, METH_VARARGS, ""},
285+
{"TritonContext", (PyCFunction)triton_TritonContext, METH_VARARGS, ""},
286+
{nullptr, nullptr, 0, nullptr}
241287
};
242288

243289
}; /* python namespace */

0 commit comments

Comments
 (0)