Loading [MathJax]/extensions/tex2jax.js
libTriton version 1.0 build 1599
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
context.cpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
9#include <triton/arm32Cpu.hpp>
10#include <triton/config.hpp>
11#include <triton/context.hpp>
12#include <triton/exceptions.hpp>
13#include <triton/riscv32Cpu.hpp>
14#include <triton/riscv64Cpu.hpp>
15#include <triton/x8664Cpu.hpp>
16#include <triton/x86Cpu.hpp>
17
18#include <list>
19#include <map>
20#include <memory>
21#include <new>
22
23
171namespace triton {
172
174 callbacks(*this),
175 arch(&this->callbacks) {
176 this->modes = std::make_shared<triton::modes::Modes>();
177 this->astCtxt = std::make_shared<triton::ast::AstContext>(this->modes);
178 }
179
180
185
186
188 this->removeEngines();
189 }
190
191
192 inline void Context::checkArchitecture(void) const {
193 if (!this->isArchitectureValid())
194 throw triton::exceptions::Context("Context::checkArchitecture(): You must define an architecture.");
195 }
196
197
198 inline void Context::checkIrBuilder(void) const {
199 if (!this->irBuilder)
200 throw triton::exceptions::Context("Context::checkIrBuilder(): IR builder is undefined, you should define an architecture first.");
201 }
202
203
204 inline void Context::checkSymbolic(void) const {
205 if (!this->symbolic)
206 throw triton::exceptions::Context("Context::checkSymbolic(): Symbolic engine is undefined, you should define an architecture first.");
207 }
208
209
210 inline void Context::checkSolver(void) const {
211 if (!this->solver)
212 throw triton::exceptions::Context("Context::checkSolver(): Solver engine is undefined, you should define an architecture first.");
213 }
214
215
216 inline void Context::checkTaint(void) const {
217 if (!this->taint)
218 throw triton::exceptions::Context("Context::checkTaint(): Taint engine is undefined, you should define an architecture first.");
219 }
220
221
222 inline void Context::checkLifting(void) const {
223 if (!this->lifting)
224 throw triton::exceptions::Context("Context::checkLifting(): Lifting engine is undefined, you should define an architecture first.");
225 }
226
227
228
229 /* Architecture Context ============================================================================== */
230
232 return this->arch.isValid();
233 }
234
235
239
240
244
245
247 if (!this->isArchitectureValid())
248 throw triton::exceptions::Context("Context::checkArchitecture(): You must define an architecture.");
249 return this->arch.getCpuInstance();
250 }
251
252
254 /* Setup and init the targeted architecture */
255 this->arch.setArchitecture(arch);
256
257 /* remove and re-init previous engines (when setArchitecture() has been called twice) */
258 this->removeEngines();
259 this->initEngines();
260 }
261
262
264 this->checkArchitecture();
265 this->arch.clearArchitecture();
266 }
267
268
270 return this->arch.isFlag(regId);
271 }
272
273
275 return this->arch.isFlag(reg);
276 }
277
278
280 return this->arch.isRegister(regId);
281 }
282
283
285 return this->arch.isRegister(reg);
286 }
287
288
292
293
294 const triton::arch::Register& Context::getRegister(const std::string& name) const {
295 return this->arch.getRegister(name);
296 }
297
298
302
303
307
308
310 return this->arch.isRegisterValid(regId);
311 }
312
313
315 return this->arch.isRegisterValid(reg);
316 }
317
318
319 bool Context::isThumb(void) const {
320 return this->arch.isThumb();
321 }
322
323
324 void Context::setThumb(bool state) {
325 this->arch.setThumb(state);
326 }
327
328
330 return this->arch.gprBitSize();
331 }
332
333
335 return this->arch.gprSize();
336 }
337
338
342
343
345 return this->arch.getNopInstruction();
346 }
347
348
349 const std::unordered_map<triton::arch::register_e, const triton::arch::Register>& Context::getAllRegisters(void) const {
350 this->checkArchitecture();
351 return this->arch.getAllRegisters();
352 }
353
354 const std::unordered_map<triton::uint64, triton::uint8, IdentityHash<triton::uint64>>& Context::getConcreteMemory(void) const {
355 this->checkArchitecture();
356 return this->arch.getConcreteMemory();
357 }
358
359
360 std::set<const triton::arch::Register*> Context::getParentRegisters(void) const {
361 this->checkArchitecture();
362 return this->arch.getParentRegisters();
363 }
364
365
367 this->checkArchitecture();
368 return this->arch.getConcreteMemoryValue(addr, execCallbacks);
369 }
370
371
373 this->checkArchitecture();
374 return this->arch.getConcreteMemoryValue(mem, execCallbacks);
375 }
376
377
378 std::vector<triton::uint8> Context::getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks) const {
379 this->checkArchitecture();
380 return this->arch.getConcreteMemoryAreaValue(baseAddr, size, execCallbacks);
381 }
382
383
385 this->checkArchitecture();
386 return this->arch.getConcreteRegisterValue(reg, execCallbacks);
387 }
388
389
390 void Context::setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks) {
391 this->checkArchitecture();
392 this->arch.setConcreteMemoryValue(addr, value, execCallbacks);
393 /*
394 * In order to synchronize the concrete state with the symbolic
395 * one, the symbolic expression is concretized.
396 */
397 this->concretizeMemory(addr);
398 }
399
400
401 void Context::setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value, bool execCallbacks) {
402 this->checkArchitecture();
403 this->arch.setConcreteMemoryValue(mem, value, execCallbacks);
404 /*
405 * In order to synchronize the concrete state with the symbolic
406 * one, the symbolic expression is concretized.
407 */
408 this->concretizeMemory(mem);
409 }
410
411
412 void Context::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values, bool execCallbacks) {
413 this->checkArchitecture();
414 this->arch.setConcreteMemoryAreaValue(baseAddr, values, execCallbacks);
415 /*
416 * In order to synchronize the concrete state with the symbolic
417 * one, the symbolic expression is concretized.
418 */
419 for (triton::usize index = 0 ; index < values.size() ; index++) {
420 this->concretizeMemory(baseAddr + index);
421 }
422 }
423
424
425 void Context::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void* area, triton::usize size, bool execCallbacks) {
426 this->checkArchitecture();
427 this->arch.setConcreteMemoryAreaValue(baseAddr, area, size, execCallbacks);
428 /*
429 * In order to synchronize the concrete state with the symbolic
430 * one, the symbolic expression is concretized.
431 */
432 for (triton::usize index = 0 ; index < size ; index++) {
433 this->concretizeMemory(baseAddr + index);
434 }
435 }
436
437
438 void Context::setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value, bool execCallbacks) {
439 this->checkArchitecture();
440 this->arch.setConcreteRegisterValue(reg, value, execCallbacks);
441 /*
442 * In order to synchronize the concrete state with the symbolic
443 * one, the symbolic expression is concretized.
444 */
445 this->concretizeRegister(reg);
446 }
447
448
450 if (this->getArchitecture() != other.getArchitecture()) {
451 throw triton::exceptions::Engines("Context::setConcreteState(): Not the same architecture.");
452 }
453
454 switch (this->getArchitecture()) {
456 *static_cast<triton::arch::x86::x8664Cpu*>(this->getCpuInstance()) = *static_cast<triton::arch::x86::x8664Cpu*>(other.getCpuInstance());
457 break;
459 *static_cast<triton::arch::x86::x86Cpu*>(this->getCpuInstance()) = *static_cast<triton::arch::x86::x86Cpu*>(other.getCpuInstance());
460 break;
463 break;
466 break;
469 break;
472 break;
473 default:
474 throw triton::exceptions::Engines("Context::setConcreteState(): Invalid architecture.");
475 }
476
477 this->concretizeAllMemory();
478 this->concretizeAllRegister();
479 }
480
481
483 this->checkArchitecture();
484 return this->arch.isConcreteMemoryValueDefined(mem);
485 }
486
487
489 this->checkArchitecture();
490 return this->arch.isConcreteMemoryValueDefined(baseAddr, size);
491 }
492
493
495 this->checkArchitecture();
497 }
498
499
501 this->checkArchitecture();
502 this->arch.clearConcreteMemoryValue(baseAddr, size);
503 }
504
505
507 this->checkArchitecture();
508 this->arch.disassembly(inst);
509 }
510
511
513 this->checkArchitecture();
514 this->arch.disassembly(block, addr);
515 }
516
517
518 std::vector<triton::arch::Instruction> Context::disassembly(triton::uint64 addr, triton::usize count) const {
519 this->checkArchitecture();
520 return this->arch.disassembly(addr, count);
521 }
522
523
524 triton::arch::BasicBlock Context::disassembly(triton::uint64 addr, bool(*filterCallback)(std::vector<triton::arch::Instruction>&)) const {
525 this->checkArchitecture();
526 return this->arch.disassembly(addr, filterCallback);
527 }
528
529
531 this->checkArchitecture();
532 return this->arch.disassembly(addr);
533 }
534
535
536
537 /* Processing Context ================================================================================ */
538
540 this->checkArchitecture();
541
542 this->symbolic = new(std::nothrow) triton::engines::symbolic::SymbolicEngine(&this->arch, this->modes, this->astCtxt, &this->callbacks);
543 if (this->symbolic == nullptr)
544 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
545
546 this->solver = new(std::nothrow) triton::engines::solver::SolverEngine();
547 if (this->solver == nullptr)
548 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
549
550 this->taint = new(std::nothrow) triton::engines::taint::TaintEngine(this->modes, this->symbolic, *this->getCpuInstance());
551 if (this->taint == nullptr)
552 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
553
554 this->lifting = new(std::nothrow) triton::engines::lifters::LiftingEngine(this->astCtxt, this->symbolic);
555 if (this->lifting == nullptr)
556 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
557
558 this->irBuilder = new(std::nothrow) triton::arch::IrBuilder(&this->arch, this->modes, this->astCtxt, this->symbolic, this->taint);
559 if (this->irBuilder == nullptr)
560 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
561
562 /* Setup registers shortcut */
563 this->registers.init(this->arch.getArchitecture());
564 }
565
566
568 if (this->isArchitectureValid()) {
569 delete this->irBuilder;
570 delete this->lifting;
571 delete this->solver;
572 delete this->symbolic;
573 delete this->taint;
574
575 this->astCtxt = nullptr;
576 this->irBuilder = nullptr;
577 this->lifting = nullptr;
578 this->solver = nullptr;
579 this->symbolic = nullptr;
580 this->taint = nullptr;
581 }
582
583 // Clean up the ast context
584 this->astCtxt = std::make_shared<triton::ast::AstContext>(this->modes);
585
586 // Clean up the registers shortcut
587 this->registers.clear();
588 }
589
590
591 void Context::reset(void) {
592 if (this->isArchitectureValid()) {
593 this->removeEngines();
594 this->initEngines();
595 this->clearArchitecture();
596 this->clearCallbacks();
597 this->clearModes();
598 }
599 }
600
601
603 this->checkArchitecture();
604 this->arch.disassembly(inst);
605 return this->irBuilder->buildSemantics(inst);
606 }
607
608
610 this->checkArchitecture();
611 this->arch.disassembly(block, addr);
612 return this->irBuilder->buildSemantics(block);
613 }
614
615
616
617 /* IR builder Context ================================================================================= */
618
620 this->checkIrBuilder();
621 return this->irBuilder->buildSemantics(inst);
622 }
623
624
626 this->checkIrBuilder();
627 return this->irBuilder->buildSemantics(block);
628 }
629
630
634
635
636
637 /* AST representation Context ========================================================================= */
638
640 return this->astCtxt->getRepresentationMode();
641 }
642
643
645 this->astCtxt->setRepresentationMode(mode);
646 }
647
648
649
650 /* Callbacks Context ================================================================================= */
651
655 template TRITON_EXPORT void Context::addCallback(triton::callbacks::callback_e kind, ComparableFunctor<void(triton::Context&, const triton::arch::Register&, const triton::uint512& value)> cb);
657
663
664
667 }
668
669
676
677
679 if (this->callbacks.isDefined()) {
680 this->callbacks.processCallbacks(kind, mem);
681 }
682 }
683
684
686 if (this->callbacks.isDefined()) {
687 this->callbacks.processCallbacks(kind, reg);
688 }
689 }
690
691
692
693 /* Modes Context======================================================================================= */
694
696 this->modes->setMode(mode, flag);
697 }
698
699
701 return this->modes->isModeEnabled(mode);
702 }
703
704
706 this->modes->clearModes();
707 }
708
709
710
711 /* Symbolic engine Context ============================================================================ */
712
714 this->checkSymbolic();
715 return this->symbolic;
716 }
717
718
720 this->checkSymbolic();
721 return this->symbolic->symbolizeExpression(exprId, symVarSize, symVarAlias);
722 }
723
724
726 this->checkSymbolic();
727 return this->symbolic->symbolizeMemory(mem, symVarAlias);
728 }
729
730
732 this->checkSymbolic();
733 this->symbolic->symbolizeMemory(addr, size);
734 }
735
736
738 this->checkSymbolic();
739 return this->symbolic->symbolizeRegister(reg, symVarAlias);
740 }
741
742
744 this->checkSymbolic();
745 return this->symbolic->getOperandAst(op);
746 }
747
748
750 this->checkSymbolic();
751 return this->symbolic->getOperandAst(inst, op);
752 }
753
754
756 this->checkSymbolic();
757 return this->symbolic->getImmediateAst(imm);
758 }
759
760
762 this->checkSymbolic();
763 return this->symbolic->getImmediateAst(inst, imm);
764 }
765
766
768 this->checkSymbolic();
769 return this->symbolic->getMemoryAst(mem);
770 }
771
772
774 this->checkSymbolic();
775 return this->symbolic->getMemoryAst(inst, mem);
776 }
777
778
780 this->checkSymbolic();
781 return this->symbolic->getRegisterAst(reg);
782 }
783
784
786 this->checkSymbolic();
787 return this->symbolic->getRegisterAst(inst, reg);
788 }
789
790
795
796
798 this->checkSymbolic();
800 }
801
802
804 this->checkSymbolic();
805 return this->symbolic->removeSymbolicExpression(expr);
806 }
807
808
810 this->checkSymbolic();
811 return this->symbolic->createSymbolicExpression(inst, node, dst, comment);
812 }
813
814
816 this->checkSymbolic();
817 return this->symbolic->createSymbolicMemoryExpression(inst, node, mem, comment);
818 }
819
820
822 this->checkSymbolic();
823 return this->symbolic->createSymbolicRegisterExpression(inst, node, reg, comment);
824 }
825
826
828 this->checkSymbolic();
829 return this->symbolic->createSymbolicVolatileExpression(inst, node, comment);
830 }
831
832
837
838
843
844
849
850
851 std::unordered_map<triton::arch::register_e, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicRegisters(void) const {
852 this->checkSymbolic();
853 return this->symbolic->getSymbolicRegisters();
854 }
855
856
857 std::unordered_map<triton::uint64, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicMemory(void) const {
858 this->checkSymbolic();
859 return this->symbolic->getSymbolicMemory();
860 }
861
862
864 this->checkSymbolic();
865 return this->symbolic->getSymbolicRegister(reg);
866 }
867
868
870 this->checkSymbolic();
871 return this->symbolic->getSymbolicMemoryValue(address);
872 }
873
874
876 this->checkSymbolic();
877 return this->symbolic->getSymbolicMemoryValue(mem);
878 }
879
880
881 std::vector<triton::uint8> Context::getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size) {
882 this->checkSymbolic();
883 return this->symbolic->getSymbolicMemoryAreaValue(baseAddr, size);
884 }
885
886
888 this->checkSymbolic();
889 return this->symbolic->getSymbolicRegisterValue(reg);
890 }
891
892
893 triton::ast::SharedAbstractNode Context::simplify(const triton::ast::SharedAbstractNode& node, bool usingSolver, bool usingLLVM) const {
894 if (usingSolver) {
895 return this->simplifyAstViaSolver(node);
896 }
897 else if (usingLLVM) {
898 return this->simplifyAstViaLLVM(node);
899 }
900 else {
901 this->checkSymbolic();
902 return this->symbolic->simplify(node);
903 }
904 }
905
906
908 this->checkSymbolic();
909 return this->symbolic->simplify(block, padding);
910 }
911
912
914 this->checkSymbolic();
915 return this->symbolic->getSymbolicExpression(symExprId);
916 }
917
918
920 this->checkSymbolic();
921 return this->symbolic->getConcreteVariableValue(symVar);
922 }
923
924
926 this->checkSymbolic();
927 this->symbolic->setConcreteVariableValue(symVar, value);
928 }
929
930
932 this->checkSymbolic();
933 return this->symbolic->getSymbolicVariable(symVarId);
934 }
935
936
938 this->checkSymbolic();
939 return this->symbolic->getSymbolicVariable(symVarName);
940 }
941
942
943 const std::vector<triton::engines::symbolic::PathConstraint>& Context::getPathConstraints(void) const {
944 this->checkSymbolic();
945 return this->symbolic->getPathConstraints();
946 }
947
948
949 std::vector<triton::engines::symbolic::PathConstraint> Context::getPathConstraints(triton::usize start, triton::usize end) const {
950 this->checkSymbolic();
951 return this->symbolic->getPathConstraints(start, end);
952 }
953
954
955 std::vector<triton::engines::symbolic::PathConstraint> Context::getPathConstraintsOfThread(triton::uint32 threadId) const {
956 this->checkSymbolic();
957 return this->symbolic->getPathConstraintsOfThread(threadId);
958 }
959
960
962 this->checkSymbolic();
963 return this->symbolic->getSizeOfPathConstraints();
964 }
965
966
968 this->checkSymbolic();
969 return this->symbolic->getPathPredicate();
970 }
971
972
973 std::vector<triton::ast::SharedAbstractNode> Context::getPredicatesToReachAddress(triton::uint64 addr) {
974 this->checkSymbolic();
975 return this->symbolic->getPredicatesToReachAddress(addr);
976 }
977
978
979 void Context::pushPathConstraint(const triton::ast::SharedAbstractNode& node, const std::string& comment) {
980 this->checkSymbolic();
981 this->symbolic->pushPathConstraint(node, comment);
982 }
983
984
986 this->checkSymbolic();
987 this->symbolic->pushPathConstraint(pco);
988 }
989
990
992 this->checkSymbolic();
994 }
995
996
998 this->checkSymbolic();
1000 }
1001
1002
1004 this->checkSymbolic();
1005 return this->symbolic->isSymbolicExpressionExists(symExprId);
1006 }
1007
1008
1010 this->checkSymbolic();
1011 return this->symbolic->isMemorySymbolized(mem);
1012 }
1013
1014
1016 this->checkSymbolic();
1017 return this->symbolic->isMemorySymbolized(addr, size);
1018 }
1019
1020
1022 this->checkSymbolic();
1023 return this->symbolic->isRegisterSymbolized(reg);
1024 }
1025
1026
1028 this->checkSymbolic();
1030 }
1031
1032
1034 this->checkSymbolic();
1036 }
1037
1038
1040 this->checkSymbolic();
1041 this->symbolic->concretizeMemory(mem);
1042 }
1043
1044
1046 this->checkSymbolic();
1047 this->symbolic->concretizeMemory(addr);
1048 }
1049
1050
1052 this->checkSymbolic();
1053 this->symbolic->concretizeRegister(reg);
1054 }
1055
1056
1058 this->checkSymbolic();
1059 this->symbolic->initLeaAst(mem);
1060 }
1061
1062
1063 std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> Context::sliceExpressions(const triton::engines::symbolic::SharedSymbolicExpression& expr) {
1064 this->checkSymbolic();
1065 return this->symbolic->sliceExpressions(expr);
1066 }
1067
1068
1069 std::vector<triton::engines::symbolic::SharedSymbolicExpression> Context::getTaintedSymbolicExpressions(void) const {
1070 this->checkSymbolic();
1072 }
1073
1074
1075 std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicExpressions(void) const {
1076 this->checkSymbolic();
1077 return this->symbolic->getSymbolicExpressions();
1078 }
1079
1080
1081 std::map<triton::usize, triton::engines::symbolic::SharedSymbolicVariable> Context::getSymbolicVariables(void) const {
1082 this->checkSymbolic();
1083 return this->symbolic->getSymbolicVariables();
1084 }
1085
1086
1087
1088 /* Solver engine Context ============================================================================= */
1089
1091 this->checkSolver();
1092 return this->solver->getSolver();
1093 }
1094
1095
1097 this->checkSolver();
1098 return this->solver->getSolverInstance();
1099 }
1100
1101
1103 this->checkSolver();
1104 this->solver->setSolver(kind);
1105 }
1106
1107
1109 this->checkSolver();
1110 this->solver->setCustomSolver(customSolver);
1111 }
1112
1113
1114 bool Context::isSolverValid(void) const {
1115 this->checkSolver();
1116 return this->solver->isValid();
1117 }
1118
1119
1120 std::unordered_map<triton::usize, triton::engines::solver::SolverModel> Context::getModel(const triton::ast::SharedAbstractNode& node, triton::engines::solver::status_e* status, triton::uint32 timeout, triton::uint32* solvingTime) const {
1121 this->checkSolver();
1122 return this->solver->getModel(node, status, timeout, solvingTime);
1123 }
1124
1125
1126 std::vector<std::unordered_map<triton::usize, triton::engines::solver::SolverModel>> Context::getModels(const triton::ast::SharedAbstractNode& node, triton::uint32 limit, triton::engines::solver::status_e* status, triton::uint32 timeout, triton::uint32* solvingTime) const {
1127 this->checkSolver();
1128 return this->solver->getModels(node, limit, status, timeout, solvingTime);
1129 }
1130
1131
1133 this->checkSolver();
1134 return this->solver->isSat(node, status, timeout, solvingTime);
1135 }
1136
1137
1139 this->checkSolver();
1140 #ifdef TRITON_Z3_INTERFACE
1142 return reinterpret_cast<const triton::engines::solver::Z3Solver*>(this->getSolverInstance())->evaluate(node);
1143 }
1144 #endif
1145 #ifdef TRITON_BITWUZLA_INTERFACE
1147 return reinterpret_cast<const triton::engines::solver::BitwuzlaSolver*>(this->getSolverInstance())->evaluate(node);
1148 }
1149 #endif
1150 throw triton::exceptions::Context("Context::evaluateAstViaZ3(): Solver instance must be a SOLVER_Z3 or SOLVER_BITWUZLA.");
1151 }
1152
1153
1155 this->checkSolver();
1156 #ifdef TRITON_Z3_INTERFACE
1158 return reinterpret_cast<const triton::engines::solver::Z3Solver*>(this->getSolverInstance())->simplify(node);
1159 }
1160 #endif
1161 throw triton::exceptions::Context("Context::simplifyAstViaSolver(): Solver instance must be a SOLVER_Z3.");
1162 }
1163
1164
1166 this->checkSolver();
1167 this->solver->setTimeout(ms);
1168 }
1169
1170
1172 this->checkSolver();
1173 this->solver->setMemoryLimit(limit);
1174 }
1175
1176
1177
1178 /* Taint engine Context ============================================================================== */
1179
1181 this->checkTaint();
1182 return this->taint;
1183 }
1184
1185
1186 const std::unordered_set<triton::uint64>& Context::getTaintedMemory(void) const {
1187 this->checkTaint();
1188 return this->taint->getTaintedMemory();
1189 }
1190
1191
1192 std::unordered_set<const triton::arch::Register*> Context::getTaintedRegisters(void) const {
1193 this->checkTaint();
1194 return this->taint->getTaintedRegisters();
1195 }
1196
1197
1199 this->checkTaint();
1200 return this->taint->isTainted(op);
1201 }
1202
1203
1205 this->checkTaint();
1206 return this->taint->isMemoryTainted(addr, size);
1207 }
1208
1209
1211 this->checkTaint();
1212 return this->taint->isMemoryTainted(mem);
1213 }
1214
1215
1217 this->checkTaint();
1218 return this->taint->isRegisterTainted(reg);
1219 }
1220
1221
1223 this->checkTaint();
1224 return this->taint->setTaint(op, flag);
1225 }
1226
1227
1229 this->checkTaint();
1230 this->taint->setTaintMemory(mem, flag);
1231 return flag;
1232 }
1233
1234
1236 this->checkTaint();
1237 this->taint->setTaintRegister(reg, flag);
1238 return flag;
1239 }
1240
1241
1243 this->checkTaint();
1244 return this->taint->taintMemory(addr);
1245 }
1246
1247
1249 this->checkTaint();
1250 return this->taint->taintMemory(mem);
1251 }
1252
1253
1255 this->checkTaint();
1256 return this->taint->taintRegister(reg);
1257 }
1258
1259
1261 this->checkTaint();
1262 return this->taint->untaintMemory(addr);
1263 }
1264
1265
1267 this->checkTaint();
1268 return this->taint->untaintMemory(mem);
1269 }
1270
1271
1273 this->checkTaint();
1274 return this->taint->untaintRegister(reg);
1275 }
1276
1277
1279 this->checkTaint();
1280 return this->taint->taintUnion(op1, op2);
1281 }
1282
1283
1285 this->checkTaint();
1286 return this->taint->taintUnion(memDst, imm);
1287 }
1288
1289
1291 this->checkTaint();
1292 return this->taint->taintUnion(memDst, memSrc);
1293 }
1294
1295
1297 this->checkTaint();
1298 return this->taint->taintUnion(memDst, regSrc);
1299 }
1300
1301
1303 this->checkTaint();
1304 return this->taint->taintUnion(regDst, imm);
1305 }
1306
1307
1309 this->checkTaint();
1310 return this->taint->taintUnion(regDst, memSrc);
1311 }
1312
1313
1315 this->checkTaint();
1316 return this->taint->taintUnion(regDst, regSrc);
1317 }
1318
1319
1321 this->checkTaint();
1322 return this->taint->taintAssignment(op1, op2);
1323 }
1324
1325
1327 this->checkTaint();
1328 return this->taint->taintAssignment(memDst, imm);
1329 }
1330
1331
1333 this->checkTaint();
1334 return this->taint->taintAssignment(memDst, memSrc);
1335 }
1336
1337
1339 this->checkTaint();
1340 return this->taint->taintAssignment(memDst, regSrc);
1341 }
1342
1343
1345 this->checkTaint();
1346 return this->taint->taintAssignment(regDst, imm);
1347 }
1348
1349
1351 this->checkTaint();
1352 return this->taint->taintAssignment(regDst, memSrc);
1353 }
1354
1355
1357 this->checkTaint();
1358 return this->taint->taintAssignment(regDst, regSrc);
1359 }
1360
1361
1362
1363 /* Synthesizer engine Context ============================================================================= */
1364
1366 this->checkSymbolic();
1368 return synth.synthesize(node, constant, subexpr, opaque);
1369 }
1370
1371
1372
1373 /* Lifters engine Context ================================================================================= */
1374
1375 std::ostream& Context::liftToLLVM(std::ostream& stream, const triton::ast::SharedAbstractNode& node, const char* fname, bool optimize) {
1376 this->checkLifting();
1377 #ifdef TRITON_LLVM_INTERFACE
1378 return this->lifting->liftToLLVM(stream, node, fname, optimize);
1379 #endif
1380 throw triton::exceptions::Context("Context::liftToLLVM(): Triton not built with LLVM");
1381 }
1382
1383
1384 std::ostream& Context::liftToLLVM(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, const char* fname, bool optimize) {
1385 return this->liftToLLVM(stream, expr->getAst(), fname, optimize);
1386 }
1387
1388
1389 std::ostream& Context::liftToPython(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, bool icomment) {
1390 this->checkLifting();
1391 return this->lifting->liftToPython(stream, expr, icomment);
1392 }
1393
1394
1395 std::ostream& Context::liftToSMT(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, bool assert_, bool icomment) {
1396 this->checkLifting();
1397 return this->lifting->liftToSMT(stream, expr, assert_, icomment);
1398 }
1399
1400
1401 std::ostream& Context::liftToDot(std::ostream& stream, const triton::ast::SharedAbstractNode& node) {
1402 this->checkLifting();
1403 return this->lifting->liftToDot(stream, node);
1404 }
1405
1406
1407 std::ostream& Context::liftToDot(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr) {
1408 this->checkLifting();
1409 return this->lifting->liftToDot(stream, expr);
1410 }
1411
1412
1414 this->checkLifting();
1415 #ifdef TRITON_LLVM_INTERFACE
1416 return this->lifting->simplifyAstViaLLVM(node);
1417 #endif
1418 throw triton::exceptions::Context("Context::simplifyAstViaLLVM(): Triton not built with LLVM");
1419 }
1420
1421}; /* triton namespace */
This is the main Triton Context class.
Definition context.hpp:45
TRITON_EXPORT bool setTaintRegister(const triton::arch::Register &reg, bool flag)
[taint api] - Sets the flag (taint or untaint) to a register.
Definition context.cpp:1235
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable newSymbolicVariable(triton::uint32 varSize, const std::string &alias="")
[symbolic api] - Returns a new symbolic variable.
Definition context.cpp:797
TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register &reg) const
[architecture api] - Returns parent Register from a register.
Definition context.cpp:299
TRITON_EXPORT std::ostream & liftToDot(std::ostream &stream, const triton::ast::SharedAbstractNode &node)
[lifting api] - Lifts an AST and all its references to Dot format.
Definition context.cpp:1401
TRITON_EXPORT bool setTaintMemory(const triton::arch::MemoryAccess &mem, bool flag)
[taint api] - Sets the flag (taint or untaint) to a memory.
Definition context.cpp:1228
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable symbolizeExpression(triton::usize exprId, triton::uint32 symVarSize, const std::string &symVarAlias="")
[symbolic api] - Converts a symbolic expression to a symbolic variable. symVarSize must be in bits.
Definition context.cpp:719
TRITON_EXPORT void setArchitecture(triton::arch::architecture_e arch)
[architecture api] - Initializes an architecture.
Definition context.cpp:253
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & getSymbolicRegister(const triton::arch::Register &reg) const
[symbolic api] - Returns the symbolic expression assigned to the parent register.
Definition context.cpp:863
TRITON_EXPORT const std::vector< triton::engines::symbolic::PathConstraint > & getPathConstraints(void) const
[symbolic api] - Returns the logical conjunction vector of path constraints.
Definition context.cpp:943
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register &reg, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a register.
Definition context.cpp:384
TRITON_EXPORT void concretizeMemory(const triton::arch::MemoryAccess &mem)
[symbolic api] - Concretizes symbolic memory cells.
Definition context.cpp:1039
TRITON_EXPORT void setCustomSolver(triton::engines::solver::SolverInterface *customSolver)
Initializes a custom solver.
Definition context.cpp:1108
TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const
[architecture api] - Returns all memory.
Definition context.cpp:354
TRITON_EXPORT bool isArchitectureValid(void) const
[Architecture api] - Returns true if the architecture is valid.
Definition context.cpp:231
triton::ast::SharedAstContext astCtxt
The AST Context interface.
Definition context.hpp:89
TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters(void) const
[architecture api] - Returns all registers.
Definition context.cpp:349
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable symbolizeMemory(const triton::arch::MemoryAccess &mem, const std::string &symVarAlias="")
[symbolic api] - Converts a symbolic memory expression to a symbolic variable.
Definition context.cpp:725
TRITON_EXPORT bool isThumb(void) const
[architecture api] - Returns true if the execution mode is Thumb. Only useful for Arm32.
Definition context.cpp:319
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable symbolizeRegister(const triton::arch::Register &reg, const std::string &symVarAlias="")
[symbolic api] - Converts a symbolic register expression to a symbolic variable.
Definition context.cpp:737
triton::engines::symbolic::SymbolicEngine * symbolic
The symbolic engine.
Definition context.hpp:83
TRITON_EXPORT triton::engines::symbolic::SymbolicEngine * getSymbolicEngine(void)
[symbolic api] - Returns the instance of the symbolic engine.
Definition context.cpp:713
triton::arch::ShortcutRegister registers
A shortcut to access to a Register class from a register name.
Definition context.hpp:97
TRITON_EXPORT bool isRegisterTainted(const triton::arch::Register &reg) const
[taint api] - Returns true if the register is tainted.
Definition context.cpp:1216
TRITON_EXPORT void initEngines(void)
[proccesing api] - Initializes everything.
Definition context.cpp:539
TRITON_EXPORT void setSolver(triton::engines::solver::solver_e kind)
Initializes a predefined solver.
Definition context.cpp:1102
TRITON_EXPORT void setMode(triton::modes::mode_e mode, bool flag)
[modes api] - Enables or disables a specific mode.
Definition context.cpp:695
TRITON_EXPORT void popPathConstraint(void)
[symbolic api] - Pops the last constraints added to the path predicate.
Definition context.cpp:991
TRITON_EXPORT triton::uint512 evaluateAstViaSolver(const triton::ast::SharedAbstractNode &node) const
[solver api] - Evaluates a Triton's AST via the solver and returns a concrete value.
Definition context.cpp:1138
TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const
[architecture api] - Returns the endianness as triton::arch::endianness_e.
Definition context.cpp:241
TRITON_EXPORT triton::ast::SharedAbstractNode simplifyAstViaLLVM(const triton::ast::SharedAbstractNode &node) const
[lifting api] - Lifts and simplify an AST using LLVM
Definition context.cpp:1413
TRITON_EXPORT triton::uint512 getConcreteVariableValue(const triton::engines::symbolic::SharedSymbolicVariable &symVar) const
[symbolic api] - Gets the concrete value of a symbolic variable.
Definition context.cpp:919
TRITON_EXPORT std::unordered_set< const triton::arch::Register * > getTaintedRegisters(void) const
[taint api] - Returns the tainted registers.
Definition context.cpp:1192
TRITON_EXPORT std::unordered_map< triton::usize, triton::engines::symbolic::SharedSymbolicExpression > sliceExpressions(const triton::engines::symbolic::SharedSymbolicExpression &expr)
[symbolic api] - Slices all expressions from a given one.
Definition context.cpp:1063
TRITON_EXPORT triton::arch::exception_e processing(triton::arch::Instruction &inst)
[proccesing api] - Processes an instruction and updates engines according to the instruction semantic...
Definition context.cpp:602
TRITON_EXPORT bool isMemoryTainted(triton::uint64 addr, triton::uint32 size=1) const
[taint api] - Returns true if the address:size is tainted.
Definition context.cpp:1204
TRITON_EXPORT bool untaintRegister(const triton::arch::Register &reg)
[taint api] - Untaints a register. Returns !TAINTED if the register has been untainted correctly....
Definition context.cpp:1272
TRITON_EXPORT void setAstRepresentationMode(triton::ast::representations::mode_e mode)
[AST representation api] - Sets the AST representation.
Definition context.cpp:644
TRITON_EXPORT void reset(void)
[proccesing api] - Resets everything.
Definition context.cpp:591
TRITON_EXPORT std::vector< triton::uint8 > getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size)
[symbolic api] - Returns the symbolic values of a memory area.
Definition context.cpp:881
TRITON_EXPORT bool isRegisterSymbolized(const triton::arch::Register &reg) const
[symbolic api] - Returns true if the register expression contains a symbolic variable.
Definition context.cpp:1021
TRITON_EXPORT bool isMemorySymbolized(const triton::arch::MemoryAccess &mem) const
[symbolic api] - Returns true if memory cell expressions contain symbolic variables.
Definition context.cpp:1009
TRITON_EXPORT bool isModeEnabled(triton::modes::mode_e mode) const
[modes api] - Returns true if the mode is enabled.
Definition context.cpp:700
TRITON_EXPORT void assignSymbolicExpressionToRegister(const triton::engines::symbolic::SharedSymbolicExpression &se, const triton::arch::Register &reg)
[symbolic api] - Assigns a symbolic expression to a register.
Definition context.cpp:839
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicMemoryExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::MemoryAccess &mem, const std::string &comment="")
[symbolic api] - Returns the new symbolic memory expression and links this expression to the instruct...
Definition context.cpp:815
triton::arch::Architecture arch
The architecture entry.
Definition context.hpp:71
TRITON_EXPORT const triton::arch::Instruction getNopInstruction(void) const
Returns a NOP instruction according to the architecture.
Definition context.cpp:344
TRITON_EXPORT Context()
Constructor of the Context.
Definition context.cpp:173
TRITON_EXPORT void setConcreteState(triton::arch::Architecture &other)
[architecture api] - Defines a concrete state.
Definition context.cpp:449
TRITON_EXPORT bool taintRegister(const triton::arch::Register &reg)
[taint api] - Taints a register. Returns TAINTED if the register has been tainted correctly....
Definition context.cpp:1254
TRITON_EXPORT bool isSymbolicExpressionExists(triton::usize symExprId) const
[symbolic api] - Returns true if the symbolic expression ID exists.
Definition context.cpp:1003
void removeCallback(triton::callbacks::callback_e kind, T cb)
[callbacks api] - Removes a callback.
Definition context.hpp:321
TRITON_EXPORT bool isFlag(triton::arch::register_e regId) const
[architecture api] - Returns true if the register id is a flag.
Definition context.cpp:269
TRITON_EXPORT std::ostream & liftToLLVM(std::ostream &stream, const triton::ast::SharedAbstractNode &node, const char *fname="__triton", bool optimize=false)
[lifting api] - Lifts an AST and all its references to LLVM format. fname represents the name of the ...
Definition context.cpp:1375
TRITON_EXPORT triton::engines::taint::TaintEngine * getTaintEngine(void)
[taint api] - Returns the instance of the taint engine.
Definition context.cpp:1180
TRITON_EXPORT triton::usize getSizeOfPathConstraints(void) const
[symbolic api] - Returns the size of the path constraints
Definition context.cpp:961
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst) const
[architecture api] - Disassembles the instruction and setup operands.
Definition context.cpp:506
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node)
[callbacks api] - Processes callbacks according to the kind and the C++ polymorphism.
Definition context.cpp:670
TRITON_EXPORT void assignSymbolicExpressionToMemory(const triton::engines::symbolic::SharedSymbolicExpression &se, const triton::arch::MemoryAccess &mem)
[symbolic api] - Assigns a symbolic expression to a memory.
Definition context.cpp:833
void addCallback(triton::callbacks::callback_e kind, T cb)
[callbacks api] - Adds a callback.
Definition context.hpp:316
TRITON_EXPORT std::vector< triton::uint8 > getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a memory area.
Definition context.cpp:378
TRITON_EXPORT void setSolverMemoryLimit(triton::uint32 limit)
[solver api] - Defines a solver memory consumption limit (in megabytes).
Definition context.cpp:1171
TRITON_EXPORT triton::ast::SharedAstContext getAstContext(void)
[IR builder api] - Returns the AST context. Used as AST builder.
Definition context.cpp:631
TRITON_EXPORT void removeSymbolicExpression(const triton::engines::symbolic::SharedSymbolicExpression &expr)
[symbolic api] - Removes the symbolic expression corresponding to the id.
Definition context.cpp:803
TRITON_EXPORT void setThumb(bool state)
[architecture api] - Sets CPU state to Thumb mode.
Definition context.cpp:324
TRITON_EXPORT std::unordered_map< triton::usize, triton::engines::solver::SolverModel > getModel(const triton::ast::SharedAbstractNode &node, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
[solver api] - Computes and returns a model from a symbolic constraint. State is returned in the stat...
Definition context.cpp:1120
TRITON_EXPORT triton::uint32 getGprBitSize(void) const
[architecture api] - Returns the bit in byte of the General Purpose Registers.
Definition context.cpp:329
TRITON_EXPORT void concretizeAllMemory(void)
[symbolic api] - Concretizes all symbolic memory cells.
Definition context.cpp:1027
triton::engines::taint::TaintEngine * taint
The taint engine.
Definition context.hpp:80
TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::register_e id) const
[architecture api] - Returns Register from regId.
Definition context.cpp:289
TRITON_EXPORT bool taintUnion(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract union tainting.
Definition context.cpp:1278
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::OperandWrapper &dst, const std::string &comment="")
[symbolic api] - Returns the new symbolic abstract expression and links this expression to the instru...
Definition context.cpp:809
TRITON_EXPORT void setConcreteVariableValue(const triton::engines::symbolic::SharedSymbolicVariable &symVar, const triton::uint512 &value)
[symbolic api] - Sets the concrete value of a symbolic variable.
Definition context.cpp:925
triton::modes::SharedModes modes
The modes.
Definition context.hpp:74
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicExpression newSymbolicExpression(const triton::ast::SharedAbstractNode &node, const std::string &comment="")
[symbolic api] - Returns a new symbolic expression. Note that if there are simplification passes reco...
Definition context.cpp:791
TRITON_EXPORT std::vector< triton::engines::symbolic::SharedSymbolicExpression > getTaintedSymbolicExpressions(void) const
[symbolic api] - Returns the list of the tainted symbolic expressions.
Definition context.cpp:1069
TRITON_EXPORT ~Context()
Destructor of the Context.
Definition context.cpp:187
TRITON_EXPORT triton::uint8 getSymbolicMemoryValue(triton::uint64 address)
[symbolic api] - Returns the symbolic memory value.
Definition context.cpp:869
TRITON_EXPORT bool isTainted(const triton::arch::OperandWrapper &op) const
[taint api] - Abstract taint verification. Returns true if the operand is tainted.
Definition context.cpp:1198
triton::engines::solver::SolverEngine * solver
The solver engine.
Definition context.hpp:86
TRITON_EXPORT bool isRegister(triton::arch::register_e regId) const
[architecture api] - Returns true if the regId is a register.
Definition context.cpp:279
triton::arch::IrBuilder * irBuilder
The IR builder.
Definition context.hpp:92
TRITON_EXPORT triton::ast::SharedAbstractNode simplify(const triton::ast::SharedAbstractNode &node, bool usingSolver=false, bool usingLLVM=false) const
[symbolic api] - Processes all recorded AST simplifications, uses solver's simplifications if usingSo...
Definition context.cpp:893
TRITON_EXPORT std::vector< triton::ast::SharedAbstractNode > getPredicatesToReachAddress(triton::uint64 addr)
[symbolic api] - Returns path predicates which may reach the targeted address.
Definition context.cpp:973
TRITON_EXPORT bool untaintMemory(triton::uint64 addr)
[taint api] - Untaints an address. Returns !TAINTED if the address has been untainted correctly....
Definition context.cpp:1260
TRITON_EXPORT triton::arch::CpuInterface * getCpuInstance(void)
[architecture api] - Returns the instance of the current CPU used.
Definition context.cpp:246
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicVolatileExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const std::string &comment="")
[symbolic api] - Returns the new symbolic volatile expression and links this expression to the instru...
Definition context.cpp:827
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable getSymbolicVariable(triton::usize symVarId) const
[symbolic api] - Returns the symbolic variable corresponding to the symbolic variable id.
Definition context.cpp:931
triton::engines::lifters::LiftingEngine * lifting
The lifting engine.
Definition context.hpp:77
TRITON_EXPORT void concretizeAllRegister(void)
[symbolic api] - Concretizes all symbolic register.
Definition context.cpp:1033
TRITON_EXPORT triton::engines::solver::solver_e getSolver(void) const
Returns the kind of solver as triton::engines::solver::solver_e.
Definition context.cpp:1090
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
[architecture api] - Returns the architecture as triton::arch::architecture_e.
Definition context.cpp:236
TRITON_EXPORT triton::ast::SharedAbstractNode getImmediateAst(const triton::arch::Immediate &imm)
[symbolic api] - Returns the AST corresponding to the immediate.
Definition context.cpp:755
TRITON_EXPORT triton::uint32 getGprSize(void) const
[architecture api] - Returns the size in byte of the General Purpose Registers.
Definition context.cpp:334
TRITON_EXPORT std::ostream & liftToSMT(std::ostream &stream, const triton::engines::symbolic::SharedSymbolicExpression &expr, bool assert_=false, bool icomment=false)
[lifting api] - Lifts a symbolic expression and all its references to SMT format. If assert_ is true,...
Definition context.cpp:1395
TRITON_EXPORT void setSolverTimeout(triton::uint32 ms)
[solver api] - Defines a solver timeout (in milliseconds).
Definition context.cpp:1165
TRITON_EXPORT triton::ast::representations::mode_e getAstRepresentationMode(void) const
[AST representation api] - Returns the AST representation as triton::ast::representation_e.
Definition context.cpp:639
TRITON_EXPORT bool isSolverValid(void) const
Returns true if the solver is valid.
Definition context.cpp:1114
TRITON_EXPORT std::unordered_map< triton::uint64, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicMemory(void) const
[symbolic api] - Returns the map (<Addr : SymExpr>) of symbolic memory defined.
Definition context.cpp:857
TRITON_EXPORT triton::uint8 getConcreteMemoryValue(triton::uint64 addr, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a memory cell.
Definition context.cpp:366
TRITON_EXPORT void concretizeRegister(const triton::arch::Register &reg)
[symbolic api] - Concretizes a symbolic register.
Definition context.cpp:1051
TRITON_EXPORT void setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a memory cell.
Definition context.cpp:390
TRITON_EXPORT std::unordered_map< triton::arch::register_e, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicRegisters(void) const
[symbolic api] - Returns the map of symbolic registers defined.
Definition context.cpp:851
TRITON_EXPORT triton::engines::synthesis::SynthesisResult synthesize(const triton::ast::SharedAbstractNode &node, bool constant=true, bool subexpr=true, bool opaque=false)
[synthesizer api] - Synthesizes a given node. If constant is true, performa a constant synthesis....
Definition context.cpp:1365
TRITON_EXPORT void initLeaAst(triton::arch::MemoryAccess &mem, bool force=true) const
[symbolic api] - Initializes the effective address of a memory access.
Definition context.cpp:1057
TRITON_EXPORT triton::ast::SharedAbstractNode simplifyAstViaSolver(const triton::ast::SharedAbstractNode &node) const
[solver api] - Converts a Triton's AST to a solver's AST, perform a simplification and returns a Trit...
Definition context.cpp:1154
TRITON_EXPORT triton::arch::exception_e buildSemantics(triton::arch::Instruction &inst)
[IR builder api] - Builds the instruction semantics. Returns triton::arch::NO_FAULT if succeed.
Definition context.cpp:619
TRITON_EXPORT std::map< triton::usize, triton::engines::symbolic::SharedSymbolicVariable > getSymbolicVariables(void) const
[symbolic api] - Returns all symbolic variables as a map of <SymVarId : SymVar>
Definition context.cpp:1081
TRITON_EXPORT bool taintMemory(triton::uint64 addr)
[taint api] - Taints an address. Returns TAINTED if the address has been tainted correctly....
Definition context.cpp:1242
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicRegisterExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::Register &reg, const std::string &comment="")
[symbolic api] - Returns the new symbolic register expression and links this expression to the instru...
Definition context.cpp:821
TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector< triton::uint8 > &values, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a memory area.
Definition context.cpp:412
TRITON_EXPORT void pushPathConstraint(const triton::ast::SharedAbstractNode &node, const std::string &comment="")
[symbolic api] - Pushes constraint created from node to the current path predicate.
Definition context.cpp:979
TRITON_EXPORT triton::ast::SharedAbstractNode getOperandAst(const triton::arch::OperandWrapper &op)
[symbolic api] - Returns the AST corresponding to the operand.
Definition context.cpp:743
TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)
Clears concrete values assigned to the memory cells.
Definition context.cpp:494
TRITON_EXPORT void clearArchitecture(void)
[architecture api] - Clears the architecture states (registers and memory).
Definition context.cpp:263
TRITON_EXPORT const std::unordered_set< triton::uint64 > & getTaintedMemory(void) const
[taint api] - Returns the tainted addresses.
Definition context.cpp:1186
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
[architecture api] - Returns all parent registers.
Definition context.cpp:360
TRITON_EXPORT triton::uint32 getNumberOfRegisters(void) const
[architecture api] - Returns the number of registers according to the CPU architecture.
Definition context.cpp:339
TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register &reg, const triton::uint512 &value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a register.
Definition context.cpp:438
TRITON_EXPORT triton::uint512 getSymbolicRegisterValue(const triton::arch::Register &reg)
[symbolic api] - Returns the symbolic register value.
Definition context.cpp:887
TRITON_EXPORT bool taintAssignment(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract assignment tainting.
Definition context.cpp:1320
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicExpression getSymbolicExpression(triton::usize symExprId) const
[symbolic api] - Returns the symbolic expression corresponding to an id.
Definition context.cpp:913
TRITON_EXPORT void clearPathConstraints(void)
[symbolic api] - Clears the current path predicate.
Definition context.cpp:997
TRITON_EXPORT triton::ast::SharedAbstractNode getPathPredicate(void)
[symbolic api] - Returns the current path predicate as an AST of logical conjunction of each taken br...
Definition context.cpp:967
TRITON_EXPORT void clearCallbacks(void)
[callbacks api] - Clears recorded callbacks.
Definition context.cpp:665
TRITON_EXPORT std::vector< triton::engines::symbolic::PathConstraint > getPathConstraintsOfThread(triton::uint32 threadId) const
[symbolic api] - Returns the logical conjunction vector of path constraint of a given thread.
Definition context.cpp:955
TRITON_EXPORT void removeEngines(void)
[proccesing api] - Removes everything.
Definition context.cpp:567
TRITON_EXPORT triton::ast::SharedAbstractNode getRegisterAst(const triton::arch::Register &reg) const
[symbolic api] - Returns the AST corresponding to the register.
Definition context.cpp:779
TRITON_EXPORT std::vector< std::unordered_map< triton::usize, triton::engines::solver::SolverModel > > getModels(const triton::ast::SharedAbstractNode &node, triton::uint32 limit, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
[solver api] - Computes and returns several models from a symbolic constraint. The limit is the numbe...
Definition context.cpp:1126
TRITON_EXPORT void clearModes(void)
[modes api] - Clears recorded modes.
Definition context.cpp:705
TRITON_EXPORT std::unordered_map< triton::usize, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicExpressions(void) const
[symbolic api] - Returns all symbolic expressions as a map of <SymExprId : SymExpr>
Definition context.cpp:1075
TRITON_EXPORT bool isRegisterValid(triton::arch::register_e regId) const
[architecture api] - Returns true if the regId is a register or a flag.
Definition context.cpp:309
triton::callbacks::Callbacks callbacks
The Callbacks interface.
Definition context.hpp:68
TRITON_EXPORT std::ostream & liftToPython(std::ostream &stream, const triton::engines::symbolic::SharedSymbolicExpression &expr, bool icomment=false)
[lifting api] - Lifts a symbolic expression and all its references to Python format....
Definition context.cpp:1389
TRITON_EXPORT bool setTaint(const triton::arch::OperandWrapper &op, bool flag)
[taint api] - Sets the flag (taint or untaint) to an abstract operand (Register or Memory).
Definition context.cpp:1222
TRITON_EXPORT const triton::engines::solver::SolverInterface * getSolverInstance(void) const
Returns the instance of the initialized solver.
Definition context.cpp:1096
TRITON_EXPORT triton::ast::SharedAbstractNode getMemoryAst(const triton::arch::MemoryAccess &mem)
[symbolic api] - Returns the AST corresponding to the memory.
Definition context.cpp:767
TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const
Returns true if memory cells have a defined concrete value.
Definition context.cpp:482
TRITON_EXPORT bool isSat(const triton::ast::SharedAbstractNode &node, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
Returns true if an expression is satisfiable.
Definition context.cpp:1132
The abstract architecture class.
TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::register_e id) const
Returns register from id.
TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector< triton::uint8 > &values, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a memory area.
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
Returns all parent registers.
TRITON_EXPORT void setThumb(bool state)
Sets CPU state to Thumb mode. Only valid for Arm32.
TRITON_EXPORT triton::uint32 numberOfRegisters(void) const
Returns the number of registers according to the CPU architecture.
TRITON_EXPORT triton::uint32 gprBitSize(void) const
Returns the bit in bit of the General Purpose Registers.
TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register &reg, const triton::uint512 &value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a register.
TRITON_EXPORT void setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks=true)
[architecture api] - Sets the concrete value of a memory cell.
TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const
Return all memory.
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst) const
Disassembles the instruction according to the architecture.
TRITON_EXPORT void clearArchitecture(void)
Clears the architecture states (registers and memory).
TRITON_EXPORT std::vector< triton::uint8 > getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const
Returns the concrete value of a memory area.
TRITON_EXPORT const triton::arch::Instruction getNopInstruction(void) const
Returns a NOP instruction according to the architecture.
TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const
Returns true if memory cells have a defined concrete value.
TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters(void) const
Returns all registers.
TRITON_EXPORT bool isFlag(triton::arch::register_e regId) const
Returns true if the register ID is a flag.
TRITON_EXPORT triton::uint8 getConcreteMemoryValue(triton::uint64 addr, bool execCallbacks=true) const
Returns the concrete value of a memory cell.
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register &reg, bool execCallbacks=true) const
Returns the concrete value of a register.
TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)
Clears concrete values assigned to the memory cells.
TRITON_EXPORT bool isRegisterValid(triton::arch::register_e regId) const
Returns true if the register ID is a register or a flag.
TRITON_EXPORT bool isRegister(triton::arch::register_e regId) const
Returns true if the register ID is a register.
TRITON_EXPORT bool isThumb(void) const
Returns true if the execution mode is Thumb. Only valid for Arm32.
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
Returns the kind of architecture as triton::arch::architecture_e.
TRITON_EXPORT bool isValid(void) const
Returns true if the architecture is valid.
TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const
Returns the kind of endianness as triton::arch::endianness_e.
TRITON_EXPORT triton::uint32 gprSize(void) const
Returns the bit in byte of the General Purpose Registers.
TRITON_EXPORT const triton::arch::Register & getParentRegister(triton::arch::register_e id) const
Returns parent register from id.
TRITON_EXPORT triton::arch::CpuInterface * getCpuInstance(void)
Returns the instance of the current CPU used.
This class is used to represent a basic block.
This interface is used as abstract CPU interface. All CPU must use this interface.
This class is used to represent an immediate.
Definition immediate.hpp:37
This class is used to represent an instruction.
The IR builder.
Definition irBuilder.hpp:40
TRITON_EXPORT triton::arch::exception_e buildSemantics(triton::arch::Instruction &inst)
Builds the semantics of the instruction. Returns triton::arch::NO_FAULT if succeed.
Definition irBuilder.cpp:64
This class is used to represent a memory access.
This class is used as operand wrapper.
This class is used when an instruction has a register operand.
Definition register.hpp:44
void init(triton::arch::architecture_e arch)
This class is used to describe the ARM (64-bits) spec.
This class is used to describe the ARM (32-bits) spec.
Definition arm32Cpu.hpp:61
This class is used to describe the RV32 spec.
This class is used to describe the RV64 spec.
This class is used to describe the x86 (64-bits) spec.
Definition x8664Cpu.hpp:53
This class is used to describe the x86 (32-bits) spec.
Definition x86Cpu.hpp:53
TRITON_EXPORT void clearCallbacks(void)
Clears recorded callbacks.
Definition callbacks.cpp:91
TRITON_EXPORT bool isDefined(triton::callbacks::callback_e kind) const
Returns true if the callback is defined.
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node)
Processes callbacks according to the kind and the C++ polymorphism.
TRITON_EXPORT std::ostream & liftToDot(std::ostream &stream, const triton::ast::SharedAbstractNode &node)
Lifts an AST and all its references to Dot format.
TRITON_EXPORT triton::ast::SharedAbstractNode simplifyAstViaLLVM(const triton::ast::SharedAbstractNode &node) const
Lifts and simplify an AST using LLVM.
TRITON_EXPORT std::ostream & liftToLLVM(std::ostream &stream, const triton::engines::symbolic::SharedSymbolicExpression &expr, const char *fname="__triton", bool optimize=false)
Lifts a symbolic expression and all its references to LLVM format. fname represents the name of the L...
TRITON_EXPORT std::ostream & liftToPython(std::ostream &stream, const triton::engines::symbolic::SharedSymbolicExpression &expr, bool icomment=false)
Lifts a symbolic expression and all its references to Python format. If icomment is true,...
TRITON_EXPORT std::ostream & liftToSMT(std::ostream &stream, const triton::engines::symbolic::SharedSymbolicExpression &expr, bool assert_=false, bool icomment=false)
Lifts a symbolic expression and all its references to SMT format. If assert_ is true,...
Solver engine using Bitwuzla.
This class is used to interface with solvers.
TRITON_EXPORT void setSolver(triton::engines::solver::solver_e kind)
Initializes a predefined solver.
TRITON_EXPORT void setCustomSolver(triton::engines::solver::SolverInterface *customSolver)
Initializes a custom solver.
TRITON_EXPORT triton::engines::solver::solver_e getSolver(void) const
Returns the kind of solver as triton::engines::solver::solver_e.
TRITON_EXPORT void setTimeout(triton::uint32 ms)
Defines a solver timeout (in milliseconds).
TRITON_EXPORT std::unordered_map< triton::usize, SolverModel > getModel(const triton::ast::SharedAbstractNode &node, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
Computes and returns a model from a symbolic constraint. State is returned in the status pointer as w...
TRITON_EXPORT const triton::engines::solver::SolverInterface * getSolverInstance(void) const
Returns the instance of the initialized solver.
TRITON_EXPORT std::vector< std::unordered_map< triton::usize, SolverModel > > getModels(const triton::ast::SharedAbstractNode &node, triton::uint32 limit, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
Computes and returns several models from a symbolic constraint. The limit is the max number of models...
TRITON_EXPORT bool isValid(void) const
Returns true if the solver is valid.
TRITON_EXPORT void setMemoryLimit(triton::uint32 mem)
Defines a solver memory consumption limit (in megabytes).
TRITON_EXPORT bool isSat(const triton::ast::SharedAbstractNode &node, triton::engines::solver::status_e *status=nullptr, triton::uint32 timeout=0, triton::uint32 *solvingTime=nullptr) const
Returns true if an expression is satisfiable.
This interface is used to interface with solvers.
Solver engine using z3.
Definition z3Solver.hpp:49
TRITON_EXPORT triton::ast::SharedAbstractNode getPathPredicate(void) const
Returns the current path predicate as an AST of logical conjunction of each taken branch.
TRITON_EXPORT std::vector< triton::ast::SharedAbstractNode > getPredicatesToReachAddress(triton::uint64 addr) const
Returns path predicates which may reach the targeted address.
TRITON_EXPORT const std::vector< triton::engines::symbolic::PathConstraint > & getPathConstraints(void) const
Returns the logical conjunction vector of path constraints.
TRITON_EXPORT triton::usize getSizeOfPathConstraints(void) const
Returns the size of the path constraints.
TRITON_EXPORT std::vector< triton::engines::symbolic::PathConstraint > getPathConstraintsOfThread(triton::uint32 threadId) const
Returns the logical conjunction vector of path constraint of a given thread.
TRITON_EXPORT void pushPathConstraint(const triton::arch::Instruction &inst, const triton::engines::symbolic::SharedSymbolicExpression &expr)
Pushs constraints of a branch instruction to the path predicate.
TRITON_EXPORT void clearPathConstraints(void)
Clears the current path predicate.
TRITON_EXPORT void popPathConstraint(void)
Pops the last constraints added to the path predicate.
TRITON_EXPORT const SharedSymbolicExpression & createSymbolicMemoryExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::MemoryAccess &mem, const std::string &comment="")
Returns the new symbolic memory expression expression and links this expression to the instruction.
TRITON_EXPORT void concretizeMemory(const triton::arch::MemoryAccess &mem, bool array=true)
Concretizes specific symbolic memory cells.
TRITON_EXPORT const SharedSymbolicExpression & createSymbolicRegisterExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::Register &reg, const std::string &comment="")
Returns the new symbolic register expression expression and links this expression to the instruction.
TRITON_EXPORT SharedSymbolicVariable symbolizeExpression(triton::usize exprId, triton::uint32 symVarSize, const std::string &symVarAlias="")
Converts a symbolic expression to a symbolic variable. symVarSize must be in bits.
TRITON_EXPORT bool isMemorySymbolized(const triton::arch::MemoryAccess &mem) const
Returns true if memory cell expressions contain symbolic variables.
TRITON_EXPORT std::unordered_map< triton::usize, SharedSymbolicExpression > getSymbolicExpressions(void) const
Returns all symbolic expressions.
TRITON_EXPORT bool isSymbolicExpressionExists(triton::usize symExprId) const
Returns true if the symbolic expression ID exists.
TRITON_EXPORT SharedSymbolicVariable symbolizeRegister(const triton::arch::Register &reg, const std::string &symVarAlias="")
Converts a symbolic register expression to a symbolic variable.
TRITON_EXPORT SharedSymbolicExpression getSymbolicExpression(triton::usize symExprId) const
Returns the symbolic expression corresponding to an id.
TRITON_EXPORT SharedSymbolicVariable getSymbolicVariable(triton::usize symVarId) const
Returns the symbolic variable corresponding to the symbolic variable id.
TRITON_EXPORT const SharedSymbolicExpression & createSymbolicVolatileExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const std::string &comment="")
Returns the new symbolic volatile expression expression and links this expression to the instruction.
TRITON_EXPORT void assignSymbolicExpressionToMemory(const SharedSymbolicExpression &se, const triton::arch::MemoryAccess &mem)
Assigns a symbolic expression to a memory.
TRITON_EXPORT triton::ast::SharedAbstractNode getRegisterAst(const triton::arch::Register &reg) const
Returns the AST corresponding to the register.
TRITON_EXPORT void setConcreteVariableValue(const SharedSymbolicVariable &symVar, const triton::uint512 &value)
Sets the concrete value of a symbolic variable.
TRITON_EXPORT SharedSymbolicExpression getSymbolicMemory(triton::uint64 addr) const
Returns the symbolic expression assigned to the memory address.
TRITON_EXPORT void assignSymbolicExpressionToRegister(const SharedSymbolicExpression &se, const triton::arch::Register &reg)
Assigns a symbolic expression to a register.
TRITON_EXPORT std::vector< triton::uint8 > getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size)
Returns the symbolic values of a memory area.
TRITON_EXPORT std::unordered_map< triton::arch::register_e, SharedSymbolicExpression > getSymbolicRegisters(void) const
Returns the map of symbolic registers defined.
TRITON_EXPORT triton::ast::SharedAbstractNode getMemoryAst(const triton::arch::MemoryAccess &mem)
Returns the AST corresponding to the memory.
TRITON_EXPORT SharedSymbolicVariable symbolizeMemory(const triton::arch::MemoryAccess &mem, const std::string &symVarAlias="")
Converts a symbolic memory expression to a symbolic variable.
TRITON_EXPORT triton::uint512 getSymbolicRegisterValue(const triton::arch::Register &reg)
Returns the symbolic register value.
TRITON_EXPORT std::vector< SharedSymbolicExpression > getTaintedSymbolicExpressions(void) const
Returns the vector of the tainted symbolic expressions.
TRITON_EXPORT triton::uint512 getConcreteVariableValue(const SharedSymbolicVariable &symVar) const
Gets the concrete value of a symbolic variable.
TRITON_EXPORT void initLeaAst(triton::arch::MemoryAccess &mem, bool force=true) const
Initializes the effective address of a memory access.
TRITON_EXPORT SharedSymbolicVariable newSymbolicVariable(triton::engines::symbolic::variable_e type, triton::uint64 source, triton::uint32 size, const std::string &alias="")
Adds a symbolic variable.
TRITON_EXPORT const SharedSymbolicExpression & createSymbolicExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::OperandWrapper &dst, const std::string &comment="")
Returns the new symbolic expression and links this expression to the instruction.
TRITON_EXPORT SharedSymbolicExpression newSymbolicExpression(const triton::ast::SharedAbstractNode &node, triton::engines::symbolic::expression_e type, const std::string &comment="")
Creates a new symbolic expression.
TRITON_EXPORT const SharedSymbolicExpression & getSymbolicRegister(const triton::arch::Register &reg) const
Returns the symbolic expression assigned to the register.
TRITON_EXPORT void removeSymbolicExpression(const SharedSymbolicExpression &expr)
Removes the symbolic expression corresponding to the id.
TRITON_EXPORT std::unordered_map< triton::usize, SharedSymbolicExpression > sliceExpressions(const SharedSymbolicExpression &expr)
Slices all expressions from a given one.
TRITON_EXPORT triton::uint8 getSymbolicMemoryValue(triton::uint64 address)
Returns the symbolic memory value.
TRITON_EXPORT void concretizeAllMemory(void)
Concretizes all the symbolic memory.
TRITON_EXPORT triton::ast::SharedAbstractNode getImmediateAst(const triton::arch::Immediate &imm)
Returns the AST corresponding to the immediate.
TRITON_EXPORT void concretizeAllRegister(void)
Concretizes all symbolic registers.
TRITON_EXPORT std::map< triton::usize, SharedSymbolicVariable > getSymbolicVariables(void) const
Returns all symbolic variables.
TRITON_EXPORT void concretizeRegister(const triton::arch::Register &reg)
Concretizes a specific symbolic register.
TRITON_EXPORT triton::ast::SharedAbstractNode getOperandAst(const triton::arch::OperandWrapper &op)
Returns the AST corresponding to the operand.
TRITON_EXPORT bool isRegisterSymbolized(const triton::arch::Register &reg) const
Returns true if the register expression contains a symbolic variable.
TRITON_EXPORT triton::ast::SharedAbstractNode simplify(const triton::ast::SharedAbstractNode &node) const
Processes all recorded simplifications. Returns the simplified node.
The SynthesisResult engine class.
The Synthesizer engine class.
TRITON_EXPORT SynthesisResult synthesize(const triton::ast::SharedAbstractNode &node, bool constant=true, bool subexpr=true, bool opaque=false)
Synthesizes a given node. If constant is true, perform a constant synthesis. If opaque is true,...
TRITON_EXPORT bool taintRegister(const triton::arch::Register &reg)
Taints a register. Returns TAINTED if the register has been tainted correctly. Otherwise it returns t...
TRITON_EXPORT bool setTaint(const triton::arch::OperandWrapper &op, bool flag)
Sets the flag (taint or untaint) to an abstract operand (Register or Memory).
TRITON_EXPORT bool setTaintMemory(const triton::arch::MemoryAccess &mem, bool flag)
Sets the flag (taint or untaint) to a memory.
TRITON_EXPORT bool untaintMemory(triton::uint64 addr)
Untaints an address. Returns !TAINTED if the address has been untainted correctly....
TRITON_EXPORT bool isTainted(const triton::arch::OperandWrapper &op) const
Abstract taint verification. Returns true if the operand is tainted.
TRITON_EXPORT std::unordered_set< const triton::arch::Register * > getTaintedRegisters(void) const
Returns the tainted registers.
TRITON_EXPORT bool isMemoryTainted(triton::uint64 addr, triton::uint32 size=1) const
Returns true if the addr is tainted.
TRITON_EXPORT bool taintUnion(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
Abstract union tainting.
TRITON_EXPORT bool setTaintRegister(const triton::arch::Register &reg, bool flag)
Sets the flag (taint or untaint) to a register.
TRITON_EXPORT bool taintAssignment(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
Abstract assignment tainting.
TRITON_EXPORT bool untaintRegister(const triton::arch::Register &reg)
Untaints a register. Returns !TAINTED if the register has been untainted correctly....
TRITON_EXPORT bool taintMemory(triton::uint64 addr)
Taints an address. Returns TAINTED if the address has been tainted correctly. Otherwise it returns th...
TRITON_EXPORT bool isRegisterTainted(const triton::arch::Register &reg) const
Returns true if the register is tainted.
TRITON_EXPORT const std::unordered_set< triton::uint64 > & getTaintedMemory(void) const
Returns the tainted addresses.
The exception class used by the Triton's Context.
The exception class used by all engines.
register_e
Types of register.
Definition archEnums.hpp:66
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
Definition ast.hpp:59
std::shared_ptr< triton::ast::AstContext > SharedAstContext
Shared AST context.
Definition ast.hpp:65
mode_e
Enumerates all kinds of mode.
mode_e
All types of representation mode.
Definition astEnums.hpp:98
std::shared_ptr< triton::engines::symbolic::SymbolicExpression > SharedSymbolicExpression
Shared Symbolic Expression.
Definition ast.hpp:40
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
Definition ast.hpp:43
@ VOLATILE_EXPRESSION
Assigned to a volatile expression.
@ UNDEFINED_VARIABLE
Undefined assignment.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
std::uint32_t uint32
unisgned 32-bits
std::uint8_t uint8
unisgned 8-bits
The Triton namespace.