diff options
| author | Ajax <commial@gmail.com> | 2015-11-16 12:46:42 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-16 12:46:42 +0100 |
| commit | 35822fc551ce0c881c7e5216e2a2119cbed0a162 (patch) | |
| tree | 13af39242090b9d400e679ad496ccb440b34eb57 /test/arch/x86/qemu/testqemu.py | |
| parent | a014d17db74a0de84efbf7a8a21ea58739dbb39d (diff) | |
| download | miasm-35822fc551ce0c881c7e5216e2a2119cbed0a162.tar.gz miasm-35822fc551ce0c881c7e5216e2a2119cbed0a162.zip | |
Test/QEMU: emulate puts, enabling test_self_modifying_code
Diffstat (limited to 'test/arch/x86/qemu/testqemu.py')
| -rw-r--r-- | test/arch/x86/qemu/testqemu.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/arch/x86/qemu/testqemu.py b/test/arch/x86/qemu/testqemu.py index d04308e4..7cf2ab75 100644 --- a/test/arch/x86/qemu/testqemu.py +++ b/test/arch/x86/qemu/testqemu.py @@ -84,6 +84,22 @@ def xxx___printf_chk(jitter): nb_tests += 1 jitter.func_ret_cdecl(ret_ad, 0) +def xxx_puts(jitter): + ''' + #include <stdio.h> + int puts(const char *s); + + writes the string s and a trailing newline to stdout. + ''' + ret_addr, args = jitter.func_args_cdecl(['target']) + output = jitter.get_str_ansi(args.target) + # Check with expected result + line = expected.next() + if output != line.rstrip(): + print "Expected:", line + print "Obtained:", output + raise RuntimeError("Bad semantic") + return jitter.func_ret_cdecl(ret_addr, 1) # Parse arguments parser = Sandbox_Linux_x86_32.parser(description="ELF sandboxer") |