(self)
| 45 | ROOTFS: str |
| 46 | |
| 47 | def setUp(self) -> None: |
| 48 | ql = Qiling(code=NOPSLED, rootfs=self.ROOTFS, archtype=QL_ARCH.X8664, ostype=self.OSTYPE) |
| 49 | |
| 50 | self.ptr = 0x100000 |
| 51 | self.mem = ql.mem |
| 52 | |
| 53 | self.expected = { |
| 54 | 'A': 0xdeadface, |
| 55 | 'B': 0x1020304050607080, |
| 56 | 'C': DummyInternalStruct(0x11213141), |
| 57 | 'D': b'Hello World!', |
| 58 | } |
| 59 | |
| 60 | # create a dummy structure with expected values |
| 61 | dummy = DummyStruct(**self.expected) |
| 62 | |
| 63 | # emit dummy structure to memory |
| 64 | ql.mem.map(self.ptr, ql.mem.align_up(dummy.sizeof())) |
| 65 | ql.mem.write(self.ptr, bytes(dummy)) |
| 66 | |
| 67 | def __read_data(self, offset: int = 0, size: Optional[int] = None) -> bytearray: |
| 68 | return self.mem.read(self.ptr + offset, size or DummyStruct.sizeof()) |
nothing calls this directly
no test coverage detected