inter: [chore] move all exceptions into interfaces.py

(cherry picked from commit 585b754c8b)
This commit is contained in:
Oleksii Oleksenko 2024-07-23 14:42:52 +01:00
Родитель 083bd3f6fc
Коммит f217460f82
Не найден ключ, соответствующий данной подписи
5 изменённых файлов: 31 добавлений и 18 удалений

Просмотреть файл

@ -16,15 +16,12 @@ from copy import deepcopy
from .isa_loader import InstructionSet
from .interfaces import Generator, TestCase, Operand, RegisterOperand, FlagsOperand, \
MemoryOperand, ImmediateOperand, AgenOperand, LabelOperand, OT, Instruction, BasicBlock, \
Function, OperandSpec, InstructionSpec, CondOperand, Actor, ActorMode, ActorPL
from .util import NotSupportedException, Logger
Function, OperandSpec, InstructionSpec, CondOperand, Actor, ActorMode, ActorPL, \
NotSupportedException
from .util import Logger
from .config import CONF
class GeneratorException(Exception):
pass
# ==================================================================================================
# Generator Interface
# ==================================================================================================

Просмотреть файл

@ -1197,3 +1197,26 @@ class TaintTrackerInterface(ABC):
@abstractmethod
def get_taint(self) -> InputTaint:
pass
# ==================================================================================================
# Exceptions
# ==================================================================================================
class GeneratorException(Exception):
""" Exception raised when an error occurs during test case generation """
pass
class HardwareTracingError(Exception):
""" Exception raised when an error occurs during hardware tracing """
pass
class NotSupportedException(Exception):
""" Exception raised when a feature is not supported """
pass
class UnreachableCode(Exception):
""" Exception raised when an unreachable code path is reached """
pass

Просмотреть файл

@ -29,9 +29,9 @@ from unicorn import Uc, UcError, UC_MEM_WRITE, UC_MEM_READ, UC_SECOND_SCALE, UC_
from .interfaces import CTrace, TestCase, Model, InputTaint, Instruction, ExecutionTrace, \
TracedInstruction, TracedMemAccess, Input, Tracer, Actor, ActorMode, ActorPL, \
RegisterOperand, FlagsOperand, MemoryOperand, TaintTrackerInterface, TargetDesc, \
get_sandbox_addr, SANDBOX_DATA_SIZE, SANDBOX_CODE_SIZE
get_sandbox_addr, SANDBOX_DATA_SIZE, SANDBOX_CODE_SIZE, NotSupportedException, AgenOperand
from .config import CONF
from .util import Logger, NotSupportedException
from .util import Logger
# ==================================================================================================
# Custom Data Types and Constants

Просмотреть файл

@ -623,11 +623,3 @@ def stable_hash_bytes(data: bytes) -> int:
def stable_hash_intlist(data: List[int]) -> int:
return xxhash.xxh64(str(data), seed=0).intdigest()
class NotSupportedException(Exception):
pass
class UnreachableCode(Exception):
pass

Просмотреть файл

@ -14,8 +14,9 @@ from typing import List, Dict, Set, Optional
from ..isa_loader import InstructionSet
from ..interfaces import TestCase, Operand, RegisterOperand, FlagsOperand, MemoryOperand, \
ImmediateOperand, AgenOperand, OT, Instruction, BasicBlock, InstructionSpec, \
MAIN_AREA_SIZE, FAULTY_AREA_SIZE, SANDBOX_DATA_SIZE, Function, ActorPL, PAGE_SIZE
from ..generator import ConfigurableGenerator, RandomGenerator, Pass, Printer, GeneratorException
MAIN_AREA_SIZE, FAULTY_AREA_SIZE, SANDBOX_DATA_SIZE, Function, ActorPL, PAGE_SIZE, \
GeneratorException
from ..generator import ConfigurableGenerator, RandomGenerator, Pass, Printer
from ..config import CONF
from .x86_target_desc import X86TargetDesc
from .x86_elf_parser import X86ElfParser