def test_map_anywhere_bounded_preexisting_sections(self): state = State(None, None, None) mm = Memory(create_emulator(UC_ARCH_X86, UC_MODE_32, state), state) mm.map(0x10000, 0x1000) mm.map(0x15000, 0x1000) min_addr = 0x12000 max_addr = 0x14000 address1 = mm.map_anywhere( 0x1000, min_addr=min_addr, max_addr=max_addr, name="name1", kind="size1", ) self.assertEqual(mm.get_region(address1).name, "name1") self.assertGreaterEqual(address1, min_addr) self.assertLessEqual(address1, max_addr)
def test_map_anywhere_bounded_preexisting_sections(self): mm = Memory(Uc(UC_ARCH_X86, UC_MODE_32), None, 32) mm.map(0x10000, 0x1000) mm.map(0x15000, 0x1000) min_addr = 0x12000 max_addr = 0x14000 address1 = mm.map_anywhere( 0x1000, min_addr=min_addr, max_addr=max_addr, name="name1", kind="size1", ) self.assertEqual( mm.memory_info[address1], Section(mm.emu, address1, 0x1000, "name1", "size1", ""), ) self.assertGreaterEqual(address1, min_addr) self.assertLessEqual(address1, max_addr)
def test_map_anywhere_bounded_preexisting_sections(self): state = State(None, None, None) attrs = {"_get_hooks.return_value": []} hook_manager = Mock(**attrs) m = Memory( create_emulator(UC_ARCH_X86, UC_MODE_32, state), hook_manager, state, ) m.map(0x10000, 0x1000) m.map(0x15000, 0x1000) min_addr = 0x12000 max_addr = 0x14000 address1 = m.map_anywhere( 0x1000, min_addr=min_addr, max_addr=max_addr, name="name1", kind="size1", ) self.assertEqual(m.get_region(address1).name, "name1") self.assertGreaterEqual(address1, min_addr) self.assertLessEqual(address1, max_addr)