static PyObject* Instruction_getOperands(PyObject* self, PyObject* noarg) { triton::arch::ImmediateOperand imm; triton::arch::MemoryOperand mem; triton::arch::RegisterOperand reg; triton::arch::Instruction* inst; triton::uint32 opSize; PyObject* operands; inst = PyInstruction_AsInstruction(self); opSize = inst->operands.size(); operands = xPyList_New(opSize); for (triton::uint32 index = 0; index < opSize; index++) { PyObject* obj = nullptr; if (inst->operands[index].getType() == triton::arch::OP_IMM) { imm = inst->operands[index].getImm(); obj = PyImmediateOperand(imm); } else if (inst->operands[index].getType() == triton::arch::OP_MEM) { mem = inst->operands[index].getMem(); obj = PyMemoryOperand(mem); } else if (inst->operands[index].getType() == triton::arch::OP_REG) { reg = inst->operands[index].getReg(); obj = PyRegisterOperand(reg); } else continue; PyList_SetItem(operands, index, obj); } return operands; }
static PyObject* SymbolicExpression_getOriginRegister(PyObject* self, PyObject* noarg) { try { return PyRegisterOperand(PySymbolicExpression_AsSymbolicExpression(self)->getOriginRegister()); } catch (const std::exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
static PyObject* MemoryOperand_getSegmentRegister(PyObject* self, PyObject* noarg) { try { triton::arch::RegisterOperand reg(PyMemoryOperand_AsMemoryOperand(self)->getSegmentRegister()); return PyRegisterOperand(reg); } catch (const std::exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }
static PyObject* RegisterOperand_getParent(PyObject* self, PyObject* noarg) { try { triton::arch::RegisterOperand parent = PyRegisterOperand_AsRegisterOperand(self)->getParent(); return PyRegisterOperand(parent); } catch (const std::exception& e) { return PyErr_Format(PyExc_TypeError, "%s", e.what()); } }