Exemple #1
0
def test_emu_sec(sec_elf):
    with pytest.warns(MegastoneWarning) as records:
        emu = Emulator.from_execfile(sec_elf)
    assert len(records) == 1
    assert '0x400000' in records[0].message.args[0]
    assert ' RX ' in records[0].message.args[0]
    
    assert emu.arch == ARCH_MIPS
    assert emu.pc == sec_elf.symbols['__start']
    assert emu.get_curr_insn().mnemonic == 'add'
Exemple #2
0
def test_from_file(arch, isa, nop):
    address = 0x3000
    entry = isa.address_to_pointer(address + 0x10)
    data = nop * 30

    file = FORMAT_BINARY.parse_bytes(data,
                                     arch=arch,
                                     base=address,
                                     entry=entry)

    emu = Emulator.from_execfile(file)

    assert isa.address_to_pointer(emu.pc) == entry
    assert emu.isa == isa
    assert emu.get_curr_insn().mnemonic == 'nop'
    assert emu.mem.read(address, len(data)) == data
Exemple #3
0
def test_emu(seg_elf):
    emu = Emulator.from_execfile(seg_elf)
    assert emu.arch == ARCH_MIPS
    assert emu.pc == seg_elf.symbols['__start']
    assert emu.get_curr_insn().mnemonic == 'add'