diff options
| author | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-12-27 14:41:01 +0100 |
|---|---|---|
| committer | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-12-27 14:41:01 +0100 |
| commit | f2246e641d494d5df76458db4fb4928f5c2cfc7f (patch) | |
| tree | b2a0c2a1493dadb002f90f2932e22d89f659f3ea /snapshot.py | |
| parent | 2ddf26ab93c5c625c468c7d554b995e5d6b04d3a (diff) | |
| download | focaccia-f2246e641d494d5df76458db4fb4928f5c2cfc7f.tar.gz focaccia-f2246e641d494d5df76458db4fb4928f5c2cfc7f.zip | |
Extend error reporting system
Add error severities and the ability to filter for them. Include more information in comparison error messages.
Diffstat (limited to 'snapshot.py')
| -rw-r--r-- | snapshot.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/snapshot.py b/snapshot.py index be18af3..9c9e4b3 100644 --- a/snapshot.py +++ b/snapshot.py @@ -1,8 +1,10 @@ from arch.arch import Arch class MemoryAccessError(Exception): - def __init__(self, msg: str): + def __init__(self, addr: int, size: int, msg: str): super().__init__(msg) + self.mem_addr = addr + self.mem_size = size class SparseMemory: """Sparse memory. @@ -35,7 +37,8 @@ class SparseMemory: while size > 0: page_addr, off = self._to_page_addr_and_offset(addr) if page_addr not in self._pages: - raise MemoryAccessError(f'Address {addr} is not contained in' + raise MemoryAccessError(addr, size, + f'Address {addr} is not contained in' f' the sparse memory.') data = self._pages[page_addr] assert(len(data) == self.page_size) |