|
|
@ -49,6 +49,9 @@ class InstructionCoveragePlugin(LaserPlugin): |
|
|
|
def stop_sym_exec_hook(): |
|
|
|
def stop_sym_exec_hook(): |
|
|
|
# Print results |
|
|
|
# Print results |
|
|
|
for code, code_cov in self.coverage.items(): |
|
|
|
for code, code_cov in self.coverage.items(): |
|
|
|
|
|
|
|
if sum(code_cov[1]) == 0 and code_cov[0] == 0: |
|
|
|
|
|
|
|
cov_percentage = 0 |
|
|
|
|
|
|
|
else: |
|
|
|
cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100 |
|
|
|
cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100 |
|
|
|
|
|
|
|
|
|
|
|
log.info( |
|
|
|
log.info( |
|
|
@ -70,7 +73,10 @@ class InstructionCoveragePlugin(LaserPlugin): |
|
|
|
number_of_instructions, |
|
|
|
number_of_instructions, |
|
|
|
[False] * number_of_instructions, |
|
|
|
[False] * number_of_instructions, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
if global_state.mstate.pc >= len(self.coverage[code][1]): |
|
|
|
|
|
|
|
# Instruction beyond the instruction list are considered as STOP by EVM |
|
|
|
|
|
|
|
# and can be ignored |
|
|
|
|
|
|
|
return |
|
|
|
self.coverage[code][1][global_state.mstate.pc] = True |
|
|
|
self.coverage[code][1][global_state.mstate.pc] = True |
|
|
|
|
|
|
|
|
|
|
|
@symbolic_vm.laser_hook("start_sym_trans") |
|
|
|
@symbolic_vm.laser_hook("start_sym_trans") |
|
|
|