33from typing import List , Set , Iterable , Union , Optional
44
55# third-party libs
6- from triton import ARCH , CALLBACK , MODE , MemoryAccess , Instruction , AST_REPRESENTATION , OPERAND
6+ from triton import ARCH , CALLBACK , MODE , MemoryAccess , Instruction , AST_REPRESENTATION , OPERAND , EXCEPTION
77from triton import TritonContext
88
99# qsynthesis deps
@@ -418,8 +418,11 @@ def execute_blob(self, data: bytes, addr: Addr) -> bool:
418418 pc = addr
419419
420420 while addr <= pc < (addr + len (data )): # while we remain in the blob
421- opcode = self .ctx .getConcreteMemoryAreaValue (pc , 16 )
422- if not self .execute (opcode , pc ):
421+ opcode = self .ctx .getConcreteMemoryAreaValue (pc , 16 )
422+
423+ i = self .disassemble (opcode , pc )
424+
425+ if not self .execute_instruction (i ):
423426 return False
424427 pc = self .ctx .getConcreteRegisterValue (self .ins_ptr_reg )
425428
@@ -439,12 +442,13 @@ def execute_basic_block(self, data: bytes, addr: Optional[Addr] = None) -> bool:
439442 :rtype: bool
440443 """
441444 blob = data [:]
445+ cur_addr = addr
442446 while blob :
443- i = self .disassemble (blob , addr )
444- addr = None # reset to None if it was provided
447+ i = self .disassemble (blob , cur_addr )
445448 if not self .execute_instruction (i ):
446449 return False
447450 blob = blob [i .getSize ():]
451+ cur_addr += i .getSize ()
448452 return True
449453
450454 def execute (self , opcode : bytes , addr : Optional [Addr ] = None ) -> bool :
@@ -490,7 +494,7 @@ def execute_instruction(self, instr: Instruction) -> bool:
490494 e .setComment (self ._fmt_comment ())
491495
492496 self ._turn_off ()
493- return r
497+ return r == EXCEPTION . NO_FAULT
494498
495499 def _fmt_comment (self ) -> str :
496500 """Return a string identifying a SymbolicExpression in a unique manner"""
0 commit comments