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