static PyObject *Triton_opcodeToString(PyObject *self, PyObject *opcode) { if (!PyLong_Check(opcode) && !PyInt_Check(opcode)) return PyErr_Format(PyExc_TypeError, "opcodeToString(): expected an opcode (integer) as argument"); return Py_BuildValue("s", OPCODE_StringShort(PyInt_AsLong(opcode)).c_str()); }
static VOID Fini(INT32,VOID *) { out << " If/Then Arg" << endl; out << "True predicated: " << setw(16) << predicatedTrueCount << " " << setw(16) << predicatedTrueCountArg << endl; out << "First Rep : " << setw(16) << firstRepCount << " " << setw(16) << firstRepCountArg << endl; UINT64 takenTotal = 0; UINT64 takenArgTotal = 0; for (UINT32 i=0; i<(sizeof(branchCounts)/sizeof(branchCounts[0])); i++) { takenTotal = takenTotal + branchCounts[i].taken; takenArgTotal = takenArgTotal + branchCounts[i].takenArg; } out << "Branch taken : " << setw(16) << takenTotal << " " << setw(16) << takenArgTotal << endl; out << endl; for (UINT32 i=0; i<(sizeof(branchCounts)/sizeof(branchCounts[0])); i++) { UINT64 taken = branchCounts[i].taken; UINT64 takenArg = branchCounts[i].takenArg; if (taken || takenArg) { string mnemonic = OPCODE_StringShort(i); out << std::setw(20) << std::left << mnemonic << std::right << setw(13) << taken << " " << setw(16) << takenArg; if (taken != takenArg) out << " <==ERROR=="; out << endl; } } if (predicatedTrueCount != predicatedTrueCountArg || firstRepCount != firstRepCountArg || takenTotal != takenArgTotal ) { out << "***MISMATCH***" << endl; exit(1); } out.close(); exit(0); }
static void AtEnd(INT32 code, VOID *arg) { out << "Target exited with code : " << code << endl << endl; UINT32 failures = 0; for (UINT32 i=0; i<XED_ICLASS_LAST; i++) { if (testCounts[i].tested) { string mnemonic = OPCODE_StringShort(i); out << std::setw(12) << std::left << mnemonic << std::right << " " << std::setw(9) << testCounts[i].tested << std::setw(9) << testCounts[i].failed; if (testCounts[i].failed) out << " <==ERROR=="; out << endl; failures += testCounts[i].failed; } } out.close(); exit(failures ? 1 : 0); }
VOID record_ins(const THREADID threadid, const ADDRINT opCode, const ADDRINT numops, const string op_str) { auto ins_op = OPCODE_StringShort(opCode); AX_LOG_ASSEM(TraceFile, InsCount << "-" << ins_op << op_str); }
static const char *OPCODE_StringShort_detour(uint32_t opcode) { return strdup(OPCODE_StringShort(opcode).c_str()); }