Files
James Gross 80de840881 Even More Syntax Cleanup (#293)
A lot of cleanup things in prep for a python 3 transition. Getting rid of the old exception syntax, converting prints over to logging, cutting random scraps of code to be proper unit tests,  cut away some older bits of code, etc.

This still works in python2. It's just a lot of tidying up. There are no major functionality changes.
2020-09-08 13:00:06 -04:00

23 lines
666 B
Python

import envi
import envi.memory as e_mem
class WorkspaceMemoryObject(e_mem.MemoryObject):
def __init__(self, vw, maps, nosegfault=False):
self.vw = vw
self.nosegfault = nosegfault
e_mem.MemoryObject.__init__(self, maps)
# FIXME make this copy on write from the workspace
def readMemory(self, va, size):
if self.checkMemory(va):
return e_mem.MemoryObject.readMemory(self, va, size)
if self.vw.getSegment(va) is not None:
return self.vw.readMemory(va, size)
# We don't have it
if self.nosegfault:
return "A" * size
raise envi.SegmentationViolation(va)