MCPcopy Index your code
hub / github.com/qilingframework/qiling / setUp

Method setUp

tests/test_struct.py:47–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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())

Callers

nothing calls this directly

Calls 7

QilingClass · 0.90
DummyInternalStructClass · 0.85
DummyStructClass · 0.85
mapMethod · 0.80
align_upMethod · 0.80
sizeofMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected