63 static PyObject* initCode(
const std::vector<triton::uint8>& code) {
67 area[index] = code[index];
69 auto* ret = PyBytes_FromStringAndSize(
reinterpret_cast<const char*
>(area),
code.size());
76 static PyObject* initSymbols(
const std::map<std::string, triton::uint64>& symbols) {
78 for (
const auto& it :
symbols) {
85 static PyObject* initLibc(
const std::vector<triton::uint8>& code,
const std::map<std::string, triton::uint64>& symbols) {
95 static PyObject* initSystemV(
const std::vector<triton::uint8>& code,
const std::map<std::string, triton::uint64>& symbols) {
99 return systemvDictClass;
103 static PyObject* initMS(
const std::vector<triton::uint8>& code,
const std::map<std::string, triton::uint64>& symbols) {
107 return systemvDictClass;
111 static PyObject* initX8664(
void) {
113 xPyDict_SetItemString(dict,
"SYSTEMV", initSystemV(triton::stubs::x8664::systemv::libc::code, triton::stubs::x8664::systemv::libc::symbols));
114 xPyDict_SetItemString(dict,
"MS", initMS(triton::stubs::x8664::ms::libc::code, triton::stubs::x8664::ms::libc::symbols));
120 static PyObject* initAArch64(
void) {
122 xPyDict_SetItemString(dict,
"LIBC", initLibc(triton::stubs::aarch64::libc::code, triton::stubs::aarch64::libc::symbols));
128 static PyObject* initI386(
void) {
130 xPyDict_SetItemString(dict,
"SYSTEMV", initSystemV(triton::stubs::i386::systemv::libc::code, triton::stubs::i386::systemv::libc::symbols));
PyObject * xPyClass_New(PyObject *b, PyObject *d, PyObject *n)
Creates a PyClass and raises an exception if it fails. dict is copied in Py3 ! All references are dec...
PyObject * PyLong_FromUsize(triton::usize value)
Returns a pyObject from a triton::usize.
PyObject * xPyString_FromString(const char *v)
Creates a PyString and raises an exception if it fails.
void initStubsNamespace(PyObject *stubsDict)
Initializes the STUBS python namespace.
int xPyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
Same as PyDict_SetItem but decrements reference on object and key.
PyObject * xPyDict_New(void)
Creates a PyDict and raises an exception if it fails.
int xPyDict_SetItemString(PyObject *p, const char *key, PyObject *val)
Same as PyDict_SetItemString but decrements reference on object.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint8_t uint8
unisgned 8-bits
std::map< std::string, triton::uint64 > symbols
std::vector< triton::uint8 > code