libTriton version 1.0 build 1592
Loading...
Searching...
No Matches
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#ifdef COMPILE_RISCV
14#include <triton/riscv32Cpu.hpp>
15#include <triton/riscv64Cpu.hpp>
16#endif
17#include <triton/x8664Cpu.hpp>
18#include <triton/x86Cpu.hpp>
19
20#include <list>
21#include <map>
22#include <memory>
23#include <new>
24
25
173namespace triton {
174
176 callbacks(*this),
177 arch(&this->callbacks) {
178 this->modes = std::make_shared<triton::modes::Modes>();
179 this->astCtxt = std::make_shared<triton::ast::AstContext>(this->modes);
180 }
181
182
187
188
190 this->removeEngines();
191 }
192
193
194 inline void Context::checkArchitecture(void) const {
195 if (!this->isArchitectureValid())
196 throw triton::exceptions::Context("Context::checkArchitecture(): You must define an architecture.");
197 }
198
199
200 inline void Context::checkIrBuilder(void) const {
201 if (!this->irBuilder)
202 throw triton::exceptions::Context("Context::checkIrBuilder(): IR builder is undefined, you should define an architecture first.");
203 }
204
205
206 inline void Context::checkSymbolic(void) const {
207 if (!this->symbolic)
208 throw triton::exceptions::Context("Context::checkSymbolic(): Symbolic engine is undefined, you should define an architecture first.");
209 }
210
211
212 inline void Context::checkSolver(void) const {
213 if (!this->solver)
214 throw triton::exceptions::Context("Context::checkSolver(): Solver engine is undefined, you should define an architecture first.");
215 }
216
217
218 inline void Context::checkTaint(void) const {
219 if (!this->taint)
220 throw triton::exceptions::Context("Context::checkTaint(): Taint engine is undefined, you should define an architecture first.");
221 }
222
223
224 inline void Context::checkLifting(void) const {
225 if (!this->lifting)
226 throw triton::exceptions::Context("Context::checkLifting(): Lifting engine is undefined, you should define an architecture first.");
227 }
228
229
230
231 /* Architecture Context ============================================================================== */
232
234 return this->arch.isValid();
235 }
236
237
241
242
246
247
249 if (!this->isArchitectureValid())
250 throw triton::exceptions::Context("Context::checkArchitecture(): You must define an architecture.");
251 return this->arch.getCpuInstance();
252 }
253
254
256 /* Setup and init the targeted architecture */
257 this->arch.setArchitecture(arch);
258
259 /* remove and re-init previous engines (when setArchitecture() has been called twice) */
260 this->removeEngines();
261 this->initEngines();
262 }
263
264
266 this->checkArchitecture();
267 this->arch.clearArchitecture();
268 }
269
270
272 return this->arch.isFlag(regId);
273 }
274
275
277 return this->arch.isFlag(reg);
278 }
279
280
282 return this->arch.isRegister(regId);
283 }
284
285
287 return this->arch.isRegister(reg);
288 }
289
290
294
295
296 const triton::arch::Register& Context::getRegister(const std::string& name) const {
297 return this->arch.getRegister(name);
298 }
299
300
304
305
309
310
312 return this->arch.isRegisterValid(regId);
313 }
314
315
317 return this->arch.isRegisterValid(reg);
318 }
319
320
321 bool Context::isThumb(void) const {
322 return this->arch.isThumb();
323 }
324
325
326 void Context::setThumb(bool state) {
327 this->arch.setThumb(state);
328 }
329
330
332 return this->arch.gprBitSize();
333 }
334
335
337 return this->arch.gprSize();
338 }
339
340
344
345
347 return this->arch.getNopInstruction();
348 }
349
350
351 const std::unordered_map<triton::arch::register_e, const triton::arch::Register>& Context::getAllRegisters(void) const {
352 this->checkArchitecture();
353 return this->arch.getAllRegisters();
354 }
355
356 const std::unordered_map<triton::uint64, triton::uint8, IdentityHash<triton::uint64>>& Context::getConcreteMemory(void) const {
357 this->checkArchitecture();
358 return this->arch.getConcreteMemory();
359 }
360
361
362 std::set<const triton::arch::Register*> Context::getParentRegisters(void) const {
363 this->checkArchitecture();
364 return this->arch.getParentRegisters();
365 }
366
367
369 this->checkArchitecture();
370 return this->arch.getConcreteMemoryValue(addr, execCallbacks);
371 }
372
373
375 this->checkArchitecture();
376 return this->arch.getConcreteMemoryValue(mem, execCallbacks);
377 }
378
379
380 std::vector<triton::uint8> Context::getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks) const {
381 this->checkArchitecture();
382 return this->arch.getConcreteMemoryAreaValue(baseAddr, size, execCallbacks);
383 }
384
385
387 this->checkArchitecture();
388 return this->arch.getConcreteRegisterValue(reg, execCallbacks);
389 }
390
391
392 void Context::setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks) {
393 this->checkArchitecture();
394 this->arch.setConcreteMemoryValue(addr, value, execCallbacks);
395 /*
396 * In order to synchronize the concrete state with the symbolic
397 * one, the symbolic expression is concretized.
398 */
399 this->concretizeMemory(addr);
400 }
401
402
403 void Context::setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value, bool execCallbacks) {
404 this->checkArchitecture();
405 this->arch.setConcreteMemoryValue(mem, value, execCallbacks);
406 /*
407 * In order to synchronize the concrete state with the symbolic
408 * one, the symbolic expression is concretized.
409 */
410 this->concretizeMemory(mem);
411 }
412
413
414 void Context::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values, bool execCallbacks) {
415 this->checkArchitecture();
416 this->arch.setConcreteMemoryAreaValue(baseAddr, values, execCallbacks);
417 /*
418 * In order to synchronize the concrete state with the symbolic
419 * one, the symbolic expression is concretized.
420 */
421 for (triton::usize index = 0 ; index < values.size() ; index++) {
422 this->concretizeMemory(baseAddr + index);
423 }
424 }
425
426
427 void Context::setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void* area, triton::usize size, bool execCallbacks) {
428 this->checkArchitecture();
429 this->arch.setConcreteMemoryAreaValue(baseAddr, area, size, execCallbacks);
430 /*
431 * In order to synchronize the concrete state with the symbolic
432 * one, the symbolic expression is concretized.
433 */
434 for (triton::usize index = 0 ; index < size ; index++) {
435 this->concretizeMemory(baseAddr + index);
436 }
437 }
438
439
440 void Context::setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value, bool execCallbacks) {
441 this->checkArchitecture();
442 this->arch.setConcreteRegisterValue(reg, value, execCallbacks);
443 /*
444 * In order to synchronize the concrete state with the symbolic
445 * one, the symbolic expression is concretized.
446 */
447 this->concretizeRegister(reg);
448 }
449
450
452 if (this->getArchitecture() != other.getArchitecture()) {
453 throw triton::exceptions::Engines("Context::setConcreteState(): Not the same architecture.");
454 }
455
456 switch (this->getArchitecture()) {
458 *static_cast<triton::arch::x86::x8664Cpu*>(this->getCpuInstance()) = *static_cast<triton::arch::x86::x8664Cpu*>(other.getCpuInstance());
459 break;
461 *static_cast<triton::arch::x86::x86Cpu*>(this->getCpuInstance()) = *static_cast<triton::arch::x86::x86Cpu*>(other.getCpuInstance());
462 break;
465 break;
468 break;
469 #ifdef COMPILE_RISCV
470 case triton::arch::ARCH_RV64:
472 break;
473 case triton::arch::ARCH_RV32:
475 break;
476 #endif
477 default:
478 throw triton::exceptions::Engines("Context::setConcreteState(): Invalid architecture.");
479 }
480
481 this->concretizeAllMemory();
482 this->concretizeAllRegister();
483 }
484
485
487 this->checkArchitecture();
488 return this->arch.isConcreteMemoryValueDefined(mem);
489 }
490
491
493 this->checkArchitecture();
494 return this->arch.isConcreteMemoryValueDefined(baseAddr, size);
495 }
496
497
499 this->checkArchitecture();
501 }
502
503
505 this->checkArchitecture();
506 this->arch.clearConcreteMemoryValue(baseAddr, size);
507 }
508
509
511 this->checkArchitecture();
512 this->arch.disassembly(inst);
513 }
514
515
517 this->checkArchitecture();
518 this->arch.disassembly(block, addr);
519 }
520
521
522 std::vector<triton::arch::Instruction> Context::disassembly(triton::uint64 addr, triton::usize count) const {
523 this->checkArchitecture();
524 return this->arch.disassembly(addr, count);
525 }
526
527
528 triton::arch::BasicBlock Context::disassembly(triton::uint64 addr, bool(*filterCallback)(std::vector<triton::arch::Instruction>&)) const {
529 this->checkArchitecture();
530 return this->arch.disassembly(addr, filterCallback);
531 }
532
533
535 this->checkArchitecture();
536 return this->arch.disassembly(addr);
537 }
538
539
540
541 /* Processing Context ================================================================================ */
542
544 this->checkArchitecture();
545
546 this->symbolic = new(std::nothrow) triton::engines::symbolic::SymbolicEngine(&this->arch, this->modes, this->astCtxt, &this->callbacks);
547 if (this->symbolic == nullptr)
548 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
549
550 this->solver = new(std::nothrow) triton::engines::solver::SolverEngine();
551 if (this->solver == nullptr)
552 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
553
554 this->taint = new(std::nothrow) triton::engines::taint::TaintEngine(this->modes, this->symbolic, *this->getCpuInstance());
555 if (this->taint == nullptr)
556 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
557
558 this->lifting = new(std::nothrow) triton::engines::lifters::LiftingEngine(this->astCtxt, this->symbolic);
559 if (this->lifting == nullptr)
560 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
561
562 this->irBuilder = new(std::nothrow) triton::arch::IrBuilder(&this->arch, this->modes, this->astCtxt, this->symbolic, this->taint);
563 if (this->irBuilder == nullptr)
564 throw triton::exceptions::Context("Context::initEngines(): Not enough memory.");
565
566 /* Setup registers shortcut */
567 this->registers.init(this->arch.getArchitecture());
568 }
569
570
572 if (this->isArchitectureValid()) {
573 delete this->irBuilder;
574 delete this->lifting;
575 delete this->solver;
576 delete this->symbolic;
577 delete this->taint;
578
579 this->astCtxt = nullptr;
580 this->irBuilder = nullptr;
581 this->lifting = nullptr;
582 this->solver = nullptr;
583 this->symbolic = nullptr;
584 this->taint = nullptr;
585 }
586
587 // Clean up the ast context
588 this->astCtxt = std::make_shared<triton::ast::AstContext>(this->modes);
589
590 // Clean up the registers shortcut
591 this->registers.clear();
592 }
593
594
595 void Context::reset(void) {
596 if (this->isArchitectureValid()) {
597 this->removeEngines();
598 this->initEngines();
599 this->clearArchitecture();
600 this->clearCallbacks();
601 this->clearModes();
602 }
603 }
604
605
607 this->checkArchitecture();
608 this->arch.disassembly(inst);
609 return this->irBuilder->buildSemantics(inst);
610 }
611
612
614 this->checkArchitecture();
615 this->arch.disassembly(block, addr);
616 return this->irBuilder->buildSemantics(block);
617 }
618
619
620
621 /* IR builder Context ================================================================================= */
622
624 this->checkIrBuilder();
625 return this->irBuilder->buildSemantics(inst);
626 }
627
628
630 this->checkIrBuilder();
631 return this->irBuilder->buildSemantics(block);
632 }
633
634
638
639
640
641 /* AST representation Context ========================================================================= */
642
644 return this->astCtxt->getRepresentationMode();
645 }
646
647
649 this->astCtxt->setRepresentationMode(mode);
650 }
651
652
653
654 /* Callbacks Context ================================================================================= */
655
659 template TRITON_EXPORT void Context::addCallback(triton::callbacks::callback_e kind, ComparableFunctor<void(triton::Context&, const triton::arch::Register&, const triton::uint512& value)> cb);
661
667
668
671 }
672
673
680
681
683 if (this->callbacks.isDefined()) {
684 this->callbacks.processCallbacks(kind, mem);
685 }
686 }
687
688
690 if (this->callbacks.isDefined()) {
691 this->callbacks.processCallbacks(kind, reg);
692 }
693 }
694
695
696
697 /* Modes Context======================================================================================= */
698
700 this->modes->setMode(mode, flag);
701 }
702
703
705 return this->modes->isModeEnabled(mode);
706 }
707
708
710 this->modes->clearModes();
711 }
712
713
714
715 /* Symbolic engine Context ============================================================================ */
716
718 this->checkSymbolic();
719 return this->symbolic;
720 }
721
722
724 this->checkSymbolic();
725 return this->symbolic->symbolizeExpression(exprId, symVarSize, symVarAlias);
726 }
727
728
730 this->checkSymbolic();
731 return this->symbolic->symbolizeMemory(mem, symVarAlias);
732 }
733
734
736 this->checkSymbolic();
737 this->symbolic->symbolizeMemory(addr, size);
738 }
739
740
742 this->checkSymbolic();
743 return this->symbolic->symbolizeRegister(reg, symVarAlias);
744 }
745
746
748 this->checkSymbolic();
749 return this->symbolic->getOperandAst(op);
750 }
751
752
754 this->checkSymbolic();
755 return this->symbolic->getOperandAst(inst, op);
756 }
757
758
760 this->checkSymbolic();
761 return this->symbolic->getImmediateAst(imm);
762 }
763
764
766 this->checkSymbolic();
767 return this->symbolic->getImmediateAst(inst, imm);
768 }
769
770
772 this->checkSymbolic();
773 return this->symbolic->getMemoryAst(mem);
774 }
775
776
778 this->checkSymbolic();
779 return this->symbolic->getMemoryAst(inst, mem);
780 }
781
782
784 this->checkSymbolic();
785 return this->symbolic->getRegisterAst(reg);
786 }
787
788
790 this->checkSymbolic();
791 return this->symbolic->getRegisterAst(inst, reg);
792 }
793
794
799
800
802 this->checkSymbolic();
804 }
805
806
808 this->checkSymbolic();
809 return this->symbolic->removeSymbolicExpression(expr);
810 }
811
812
814 this->checkSymbolic();
815 return this->symbolic->createSymbolicExpression(inst, node, dst, comment);
816 }
817
818
820 this->checkSymbolic();
821 return this->symbolic->createSymbolicMemoryExpression(inst, node, mem, comment);
822 }
823
824
826 this->checkSymbolic();
827 return this->symbolic->createSymbolicRegisterExpression(inst, node, reg, comment);
828 }
829
830
832 this->checkSymbolic();
833 return this->symbolic->createSymbolicVolatileExpression(inst, node, comment);
834 }
835
836
841
842
847
848
853
854
855 std::unordered_map<triton::arch::register_e, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicRegisters(void) const {
856 this->checkSymbolic();
857 return this->symbolic->getSymbolicRegisters();
858 }
859
860
861 std::unordered_map<triton::uint64, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicMemory(void) const {
862 this->checkSymbolic();
863 return this->symbolic->getSymbolicMemory();
864 }
865
866
868 this->checkSymbolic();
869 return this->symbolic->getSymbolicRegister(reg);
870 }
871
872
874 this->checkSymbolic();
875 return this->symbolic->getSymbolicMemoryValue(address);
876 }
877
878
880 this->checkSymbolic();
881 return this->symbolic->getSymbolicMemoryValue(mem);
882 }
883
884
885 std::vector<triton::uint8> Context::getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size) {
886 this->checkSymbolic();
887 return this->symbolic->getSymbolicMemoryAreaValue(baseAddr, size);
888 }
889
890
892 this->checkSymbolic();
893 return this->symbolic->getSymbolicRegisterValue(reg);
894 }
895
896
897 triton::ast::SharedAbstractNode Context::simplify(const triton::ast::SharedAbstractNode& node, bool usingSolver, bool usingLLVM) const {
898 if (usingSolver) {
899 return this->simplifyAstViaSolver(node);
900 }
901 else if (usingLLVM) {
902 return this->simplifyAstViaLLVM(node);
903 }
904 else {
905 this->checkSymbolic();
906 return this->symbolic->simplify(node);
907 }
908 }
909
910
912 this->checkSymbolic();
913 return this->symbolic->simplify(block, padding);
914 }
915
916
918 this->checkSymbolic();
919 return this->symbolic->getSymbolicExpression(symExprId);
920 }
921
922
924 this->checkSymbolic();
925 return this->symbolic->getConcreteVariableValue(symVar);
926 }
927
928
930 this->checkSymbolic();
931 this->symbolic->setConcreteVariableValue(symVar, value);
932 }
933
934
936 this->checkSymbolic();
937 return this->symbolic->getSymbolicVariable(symVarId);
938 }
939
940
942 this->checkSymbolic();
943 return this->symbolic->getSymbolicVariable(symVarName);
944 }
945
946
947 const std::vector<triton::engines::symbolic::PathConstraint>& Context::getPathConstraints(void) const {
948 this->checkSymbolic();
949 return this->symbolic->getPathConstraints();
950 }
951
952
953 std::vector<triton::engines::symbolic::PathConstraint> Context::getPathConstraints(triton::usize start, triton::usize end) const {
954 this->checkSymbolic();
955 return this->symbolic->getPathConstraints(start, end);
956 }
957
958
959 std::vector<triton::engines::symbolic::PathConstraint> Context::getPathConstraintsOfThread(triton::uint32 threadId) const {
960 this->checkSymbolic();
961 return this->symbolic->getPathConstraintsOfThread(threadId);
962 }
963
964
966 this->checkSymbolic();
967 return this->symbolic->getSizeOfPathConstraints();
968 }
969
970
972 this->checkSymbolic();
973 return this->symbolic->getPathPredicate();
974 }
975
976
977 std::vector<triton::ast::SharedAbstractNode> Context::getPredicatesToReachAddress(triton::uint64 addr) {
978 this->checkSymbolic();
979 return this->symbolic->getPredicatesToReachAddress(addr);
980 }
981
982
983 void Context::pushPathConstraint(const triton::ast::SharedAbstractNode& node, const std::string& comment) {
984 this->checkSymbolic();
985 this->symbolic->pushPathConstraint(node, comment);
986 }
987
988
990 this->checkSymbolic();
991 this->symbolic->pushPathConstraint(pco);
992 }
993
994
996 this->checkSymbolic();
998 }
999
1000
1002 this->checkSymbolic();
1004 }
1005
1006
1008 this->checkSymbolic();
1009 return this->symbolic->isSymbolicExpressionExists(symExprId);
1010 }
1011
1012
1014 this->checkSymbolic();
1015 return this->symbolic->isMemorySymbolized(mem);
1016 }
1017
1018
1020 this->checkSymbolic();
1021 return this->symbolic->isMemorySymbolized(addr, size);
1022 }
1023
1024
1026 this->checkSymbolic();
1027 return this->symbolic->isRegisterSymbolized(reg);
1028 }
1029
1030
1032 this->checkSymbolic();
1034 }
1035
1036
1038 this->checkSymbolic();
1040 }
1041
1042
1044 this->checkSymbolic();
1045 this->symbolic->concretizeMemory(mem);
1046 }
1047
1048
1050 this->checkSymbolic();
1051 this->symbolic->concretizeMemory(addr);
1052 }
1053
1054
1056 this->checkSymbolic();
1057 this->symbolic->concretizeRegister(reg);
1058 }
1059
1060
1061 std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> Context::sliceExpressions(const triton::engines::symbolic::SharedSymbolicExpression& expr) {
1062 this->checkSymbolic();
1063 return this->symbolic->sliceExpressions(expr);
1064 }
1065
1066
1067 std::vector<triton::engines::symbolic::SharedSymbolicExpression> Context::getTaintedSymbolicExpressions(void) const {
1068 this->checkSymbolic();
1070 }
1071
1072
1073 std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> Context::getSymbolicExpressions(void) const {
1074 this->checkSymbolic();
1075 return this->symbolic->getSymbolicExpressions();
1076 }
1077
1078
1079 std::map<triton::usize, triton::engines::symbolic::SharedSymbolicVariable> Context::getSymbolicVariables(void) const {
1080 this->checkSymbolic();
1081 return this->symbolic->getSymbolicVariables();
1082 }
1083
1084
1085
1086 /* Solver engine Context ============================================================================= */
1087
1089 this->checkSolver();
1090 return this->solver->getSolver();
1091 }
1092
1093
1095 this->checkSolver();
1096 return this->solver->getSolverInstance();
1097 }
1098
1099
1101 this->checkSolver();
1102 this->solver->setSolver(kind);
1103 }
1104
1105
1107 this->checkSolver();
1108 this->solver->setCustomSolver(customSolver);
1109 }
1110
1111
1112 bool Context::isSolverValid(void) const {
1113 this->checkSolver();
1114 return this->solver->isValid();
1115 }
1116
1117
1118 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 {
1119 this->checkSolver();
1120 return this->solver->getModel(node, status, timeout, solvingTime);
1121 }
1122
1123
1124 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 {
1125 this->checkSolver();
1126 return this->solver->getModels(node, limit, status, timeout, solvingTime);
1127 }
1128
1129
1131 this->checkSolver();
1132 return this->solver->isSat(node, status, timeout, solvingTime);
1133 }
1134
1135
1137 this->checkSolver();
1138 #ifdef TRITON_Z3_INTERFACE
1140 return reinterpret_cast<const triton::engines::solver::Z3Solver*>(this->getSolverInstance())->evaluate(node);
1141 }
1142 #endif
1143 #ifdef TRITON_BITWUZLA_INTERFACE
1145 return reinterpret_cast<const triton::engines::solver::BitwuzlaSolver*>(this->getSolverInstance())->evaluate(node);
1146 }
1147 #endif
1148 throw triton::exceptions::Context("Context::evaluateAstViaZ3(): Solver instance must be a SOLVER_Z3 or SOLVER_BITWUZLA.");
1149 }
1150
1151
1153 this->checkSolver();
1154 #ifdef TRITON_Z3_INTERFACE
1156 return reinterpret_cast<const triton::engines::solver::Z3Solver*>(this->getSolverInstance())->simplify(node);
1157 }
1158 #endif
1159 throw triton::exceptions::Context("Context::simplifyAstViaSolver(): Solver instance must be a SOLVER_Z3.");
1160 }
1161
1162
1164 this->checkSolver();
1165 this->solver->setTimeout(ms);
1166 }
1167
1168
1170 this->checkSolver();
1171 this->solver->setMemoryLimit(limit);
1172 }
1173
1174
1175
1176 /* Taint engine Context ============================================================================== */
1177
1179 this->checkTaint();
1180 return this->taint;
1181 }
1182
1183
1184 const std::unordered_set<triton::uint64>& Context::getTaintedMemory(void) const {
1185 this->checkTaint();
1186 return this->taint->getTaintedMemory();
1187 }
1188
1189
1190 std::unordered_set<const triton::arch::Register*> Context::getTaintedRegisters(void) const {
1191 this->checkTaint();
1192 return this->taint->getTaintedRegisters();
1193 }
1194
1195
1197 this->checkTaint();
1198 return this->taint->isTainted(op);
1199 }
1200
1201
1203 this->checkTaint();
1204 return this->taint->isMemoryTainted(addr, size);
1205 }
1206
1207
1209 this->checkTaint();
1210 return this->taint->isMemoryTainted(mem);
1211 }
1212
1213
1215 this->checkTaint();
1216 return this->taint->isRegisterTainted(reg);
1217 }
1218
1219
1221 this->checkTaint();
1222 return this->taint->setTaint(op, flag);
1223 }
1224
1225
1227 this->checkTaint();
1228 this->taint->setTaintMemory(mem, flag);
1229 return flag;
1230 }
1231
1232
1234 this->checkTaint();
1235 this->taint->setTaintRegister(reg, flag);
1236 return flag;
1237 }
1238
1239
1241 this->checkTaint();
1242 return this->taint->taintMemory(addr);
1243 }
1244
1245
1247 this->checkTaint();
1248 return this->taint->taintMemory(mem);
1249 }
1250
1251
1253 this->checkTaint();
1254 return this->taint->taintRegister(reg);
1255 }
1256
1257
1259 this->checkTaint();
1260 return this->taint->untaintMemory(addr);
1261 }
1262
1263
1265 this->checkTaint();
1266 return this->taint->untaintMemory(mem);
1267 }
1268
1269
1271 this->checkTaint();
1272 return this->taint->untaintRegister(reg);
1273 }
1274
1275
1277 this->checkTaint();
1278 return this->taint->taintUnion(op1, op2);
1279 }
1280
1281
1283 this->checkTaint();
1284 return this->taint->taintUnion(memDst, imm);
1285 }
1286
1287
1289 this->checkTaint();
1290 return this->taint->taintUnion(memDst, memSrc);
1291 }
1292
1293
1295 this->checkTaint();
1296 return this->taint->taintUnion(memDst, regSrc);
1297 }
1298
1299
1301 this->checkTaint();
1302 return this->taint->taintUnion(regDst, imm);
1303 }
1304
1305
1307 this->checkTaint();
1308 return this->taint->taintUnion(regDst, memSrc);
1309 }
1310
1311
1313 this->checkTaint();
1314 return this->taint->taintUnion(regDst, regSrc);
1315 }
1316
1317
1319 this->checkTaint();
1320 return this->taint->taintAssignment(op1, op2);
1321 }
1322
1323
1325 this->checkTaint();
1326 return this->taint->taintAssignment(memDst, imm);
1327 }
1328
1329
1331 this->checkTaint();
1332 return this->taint->taintAssignment(memDst, memSrc);
1333 }
1334
1335
1337 this->checkTaint();
1338 return this->taint->taintAssignment(memDst, regSrc);
1339 }
1340
1341
1343 this->checkTaint();
1344 return this->taint->taintAssignment(regDst, imm);
1345 }
1346
1347
1349 this->checkTaint();
1350 return this->taint->taintAssignment(regDst, memSrc);
1351 }
1352
1353
1355 this->checkTaint();
1356 return this->taint->taintAssignment(regDst, regSrc);
1357 }
1358
1359
1360
1361 /* Synthesizer engine Context ============================================================================= */
1362
1364 this->checkSymbolic();
1366 return synth.synthesize(node, constant, subexpr, opaque);
1367 }
1368
1369
1370
1371 /* Lifters engine Context ================================================================================= */
1372
1373 std::ostream& Context::liftToLLVM(std::ostream& stream, const triton::ast::SharedAbstractNode& node, const char* fname, bool optimize) {
1374 this->checkLifting();
1375 #ifdef TRITON_LLVM_INTERFACE
1376 return this->lifting->liftToLLVM(stream, node, fname, optimize);
1377 #endif
1378 throw triton::exceptions::Context("Context::liftToLLVM(): Triton not built with LLVM");
1379 }
1380
1381
1382 std::ostream& Context::liftToLLVM(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, const char* fname, bool optimize) {
1383 return this->liftToLLVM(stream, expr->getAst(), fname, optimize);
1384 }
1385
1386
1387 std::ostream& Context::liftToPython(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, bool icomment) {
1388 this->checkLifting();
1389 return this->lifting->liftToPython(stream, expr, icomment);
1390 }
1391
1392
1393 std::ostream& Context::liftToSMT(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr, bool assert_, bool icomment) {
1394 this->checkLifting();
1395 return this->lifting->liftToSMT(stream, expr, assert_, icomment);
1396 }
1397
1398
1399 std::ostream& Context::liftToDot(std::ostream& stream, const triton::ast::SharedAbstractNode& node) {
1400 this->checkLifting();
1401 return this->lifting->liftToDot(stream, node);
1402 }
1403
1404
1405 std::ostream& Context::liftToDot(std::ostream& stream, const triton::engines::symbolic::SharedSymbolicExpression& expr) {
1406 this->checkLifting();
1407 return this->lifting->liftToDot(stream, expr);
1408 }
1409
1410
1412 this->checkLifting();
1413 #ifdef TRITON_LLVM_INTERFACE
1414 return this->lifting->simplifyAstViaLLVM(node);
1415 #endif
1416 throw triton::exceptions::Context("Context::simplifyAstViaLLVM(): Triton not built with LLVM");
1417 }
1418
1419}; /* 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:1233
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicVariable newSymbolicVariable(triton::uint32 varSize, const std::string &alias="")
[symbolic api] - Returns a new symbolic variable.
Definition context.cpp:801
TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register &reg) const
[architecture api] - Returns parent Register from a register.
Definition context.cpp:301
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:1399
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:1226
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:723
TRITON_EXPORT void setArchitecture(triton::arch::architecture_e arch)
[architecture api] - Initializes an architecture.
Definition context.cpp:255
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:867
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:947
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:386
TRITON_EXPORT void concretizeMemory(const triton::arch::MemoryAccess &mem)
[symbolic api] - Concretizes symbolic memory cells.
Definition context.cpp:1043
TRITON_EXPORT void setCustomSolver(triton::engines::solver::SolverInterface *customSolver)
Initializes a custom solver.
Definition context.cpp:1106
TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const
[architecture api] - Returns all memory.
Definition context.cpp:356
TRITON_EXPORT bool isArchitectureValid(void) const
[Architecture api] - Returns true if the architecture is valid.
Definition context.cpp:233
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:351
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:729
TRITON_EXPORT bool isThumb(void) const
[architecture api] - Returns true if the execution mode is Thumb. Only useful for Arm32.
Definition context.cpp:321
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:741
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:717
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:1214
TRITON_EXPORT void initEngines(void)
[proccesing api] - Initializes everything.
Definition context.cpp:543
TRITON_EXPORT void setSolver(triton::engines::solver::solver_e kind)
Initializes a predefined solver.
Definition context.cpp:1100
TRITON_EXPORT void setMode(triton::modes::mode_e mode, bool flag)
[modes api] - Enables or disables a specific mode.
Definition context.cpp:699
TRITON_EXPORT void popPathConstraint(void)
[symbolic api] - Pops the last constraints added to the path predicate.
Definition context.cpp:995
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:1136
TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const
[architecture api] - Returns the endianness as triton::arch::endianness_e.
Definition context.cpp:243
TRITON_EXPORT triton::ast::SharedAbstractNode simplifyAstViaLLVM(const triton::ast::SharedAbstractNode &node) const
[lifting api] - Lifts and simplify an AST using LLVM
Definition context.cpp:1411
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:923
TRITON_EXPORT std::unordered_set< const triton::arch::Register * > getTaintedRegisters(void) const
[taint api] - Returns the tainted registers.
Definition context.cpp:1190
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:1061
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:606
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:1202
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:1270
TRITON_EXPORT void setAstRepresentationMode(triton::ast::representations::mode_e mode)
[AST representation api] - Sets the AST representation.
Definition context.cpp:648
TRITON_EXPORT void reset(void)
[proccesing api] - Resets everything.
Definition context.cpp:595
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:885
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:1025
TRITON_EXPORT bool isMemorySymbolized(const triton::arch::MemoryAccess &mem) const
[symbolic api] - Returns true if memory cell expressions contain symbolic variables.
Definition context.cpp:1013
TRITON_EXPORT bool isModeEnabled(triton::modes::mode_e mode) const
[modes api] - Returns true if the mode is enabled.
Definition context.cpp:704
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:843
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:819
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:346
TRITON_EXPORT Context()
Constructor of the Context.
Definition context.cpp:175
TRITON_EXPORT void setConcreteState(triton::arch::Architecture &other)
[architecture api] - Defines a concrete state.
Definition context.cpp:451
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:1252
TRITON_EXPORT bool isSymbolicExpressionExists(triton::usize symExprId) const
[symbolic api] - Returns true if the symbolic expression ID exists.
Definition context.cpp:1007
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:271
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:1373
TRITON_EXPORT triton::engines::taint::TaintEngine * getTaintEngine(void)
[taint api] - Returns the instance of the taint engine.
Definition context.cpp:1178
TRITON_EXPORT triton::usize getSizeOfPathConstraints(void) const
[symbolic api] - Returns the size of the path constraints
Definition context.cpp:965
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst) const
[architecture api] - Disassembles the instruction and setup operands.
Definition context.cpp:510
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:674
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:837
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:380
TRITON_EXPORT void setSolverMemoryLimit(triton::uint32 limit)
[solver api] - Defines a solver memory consumption limit (in megabytes).
Definition context.cpp:1169
TRITON_EXPORT triton::ast::SharedAstContext getAstContext(void)
[IR builder api] - Returns the AST context. Used as AST builder.
Definition context.cpp:635
TRITON_EXPORT void removeSymbolicExpression(const triton::engines::symbolic::SharedSymbolicExpression &expr)
[symbolic api] - Removes the symbolic expression corresponding to the id.
Definition context.cpp:807
TRITON_EXPORT void setThumb(bool state)
[architecture api] - Sets CPU state to Thumb mode.
Definition context.cpp:326
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:1118
TRITON_EXPORT triton::uint32 getGprBitSize(void) const
[architecture api] - Returns the bit in byte of the General Purpose Registers.
Definition context.cpp:331
TRITON_EXPORT void concretizeAllMemory(void)
[symbolic api] - Concretizes all symbolic memory cells.
Definition context.cpp:1031
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:291
TRITON_EXPORT bool taintUnion(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract union tainting.
Definition context.cpp:1276
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:813
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:929
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:795
TRITON_EXPORT std::vector< triton::engines::symbolic::SharedSymbolicExpression > getTaintedSymbolicExpressions(void) const
[symbolic api] - Returns the list of the tainted symbolic expressions.
Definition context.cpp:1067
TRITON_EXPORT triton::ast::SharedAbstractNode getRegisterAst(const triton::arch::Register &reg)
[symbolic api] - Returns the AST corresponding to the register.
Definition context.cpp:783
TRITON_EXPORT ~Context()
Destructor of the Context.
Definition context.cpp:189
TRITON_EXPORT triton::uint8 getSymbolicMemoryValue(triton::uint64 address)
[symbolic api] - Returns the symbolic memory value.
Definition context.cpp:873
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:1196
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:281
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:897
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:977
TRITON_EXPORT bool untaintMemory(triton::uint64 addr)
[taint api] - Untaints an address. Returns !TAINTED if the address has been untainted correctly....
Definition context.cpp:1258
TRITON_EXPORT triton::arch::CpuInterface * getCpuInstance(void)
[architecture api] - Returns the instance of the current CPU used.
Definition context.cpp:248
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:831
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:935
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:1037
TRITON_EXPORT triton::engines::solver::solver_e getSolver(void) const
Returns the kind of solver as triton::engines::solver::solver_e.
Definition context.cpp:1088
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
[architecture api] - Returns the architecture as triton::arch::architecture_e.
Definition context.cpp:238
TRITON_EXPORT triton::ast::SharedAbstractNode getImmediateAst(const triton::arch::Immediate &imm)
[symbolic api] - Returns the AST corresponding to the immediate.
Definition context.cpp:759
TRITON_EXPORT triton::uint32 getGprSize(void) const
[architecture api] - Returns the size in byte of the General Purpose Registers.
Definition context.cpp:336
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:1393
TRITON_EXPORT void setSolverTimeout(triton::uint32 ms)
[solver api] - Defines a solver timeout (in milliseconds).
Definition context.cpp:1163
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:643
TRITON_EXPORT bool isSolverValid(void) const
Returns true if the solver is valid.
Definition context.cpp:1112
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:861
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:368
TRITON_EXPORT void concretizeRegister(const triton::arch::Register &reg)
[symbolic api] - Concretizes a symbolic register.
Definition context.cpp:1055
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:392
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:855
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:1363
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:1152
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:623
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:1079
TRITON_EXPORT bool taintMemory(triton::uint64 addr)
[taint api] - Taints an address. Returns TAINTED if the address has been tainted correctly....
Definition context.cpp:1240
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:825
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:414
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:983
TRITON_EXPORT triton::ast::SharedAbstractNode getOperandAst(const triton::arch::OperandWrapper &op)
[symbolic api] - Returns the AST corresponding to the operand.
Definition context.cpp:747
TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)
Clears concrete values assigned to the memory cells.
Definition context.cpp:498
TRITON_EXPORT void clearArchitecture(void)
[architecture api] - Clears the architecture states (registers and memory).
Definition context.cpp:265
TRITON_EXPORT const std::unordered_set< triton::uint64 > & getTaintedMemory(void) const
[taint api] - Returns the tainted addresses.
Definition context.cpp:1184
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
[architecture api] - Returns all parent registers.
Definition context.cpp:362
TRITON_EXPORT triton::uint32 getNumberOfRegisters(void) const
[architecture api] - Returns the number of registers according to the CPU architecture.
Definition context.cpp:341
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:440
TRITON_EXPORT triton::uint512 getSymbolicRegisterValue(const triton::arch::Register &reg)
[symbolic api] - Returns the symbolic register value.
Definition context.cpp:891
TRITON_EXPORT bool taintAssignment(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract assignment tainting.
Definition context.cpp:1318
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicExpression getSymbolicExpression(triton::usize symExprId) const
[symbolic api] - Returns the symbolic expression corresponding to an id.
Definition context.cpp:917
TRITON_EXPORT void clearPathConstraints(void)
[symbolic api] - Clears the current path predicate.
Definition context.cpp:1001
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:971
TRITON_EXPORT void clearCallbacks(void)
[callbacks api] - Clears recorded callbacks.
Definition context.cpp:669
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:959
TRITON_EXPORT void removeEngines(void)
[proccesing api] - Removes everything.
Definition context.cpp:571
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:1124
TRITON_EXPORT void clearModes(void)
[modes api] - Clears recorded modes.
Definition context.cpp:709
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:1073
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:311
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:1387
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:1220
TRITON_EXPORT const triton::engines::solver::SolverInterface * getSolverInstance(void) const
Returns the instance of the initialized solver.
Definition context.cpp:1094
TRITON_EXPORT triton::ast::SharedAbstractNode getMemoryAst(const triton::arch::MemoryAccess &mem)
[symbolic api] - Returns the AST corresponding to the memory.
Definition context.cpp:771
TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const
Returns true if memory cells have a defined concrete value.
Definition context.cpp:486
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:1130
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:72
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 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::ast::SharedAbstractNode getRegisterAst(const triton::arch::Register &reg)
Returns the AST corresponding to the register.
TRITON_EXPORT triton::uint512 getConcreteVariableValue(const SharedSymbolicVariable &symVar) const
Gets the concrete value of a symbolic variable.
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:68
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.