From a45d72ed7f81787f8ce8d6c7b1c586303fac76ef Mon Sep 17 00:00:00 2001 From: Yan Date: Sun, 23 Aug 2015 13:03:48 -0700 Subject: [PATCH] added memmap regression scripts --- regress/memmap_assert.py | 8 ++++++++ regress/memmap_segfault.py | 25 +++++++++++++++++++++++++ regress/memmap_weirdness.py | 12 ++++++++++++ 3 files changed, 45 insertions(+) create mode 100755 regress/memmap_assert.py create mode 100755 regress/memmap_segfault.py create mode 100755 regress/memmap_weirdness.py diff --git a/regress/memmap_assert.py b/regress/memmap_assert.py new file mode 100755 index 00000000..cebdb8e1 --- /dev/null +++ b/regress/memmap_assert.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +import unicorn + +u = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) +u.mem_map(0x2000, 0) +u.mem_map(0x4000, 1) +print "I am never reached" diff --git a/regress/memmap_segfault.py b/regress/memmap_segfault.py new file mode 100755 index 00000000..83aea625 --- /dev/null +++ b/regress/memmap_segfault.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import unicorn + +u = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) +u.mem_map(0x2000, 0x1000) +u.mem_read(0x2000, 1) + +for i in range(20): + try: + u = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) + u.mem_map(i*0x1000, 5) + u.mem_read(i*0x1000, 1) + print hex(i*0x1000) + " succeeeded" + except unicorn.UcError: + print hex(i*0x1000) + " failed" + +for i in range(20): + try: + u = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) + u.mem_map(i*0x1000, 5) + u.mem_read(i*0x1000, 1) + print hex(i*0x1000) + " succeeeded" + except unicorn.UcError: + print hex(i*0x1000) + " failed" diff --git a/regress/memmap_weirdness.py b/regress/memmap_weirdness.py new file mode 100755 index 00000000..d81eccd6 --- /dev/null +++ b/regress/memmap_weirdness.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import unicorn + +for i in range(20): + #try: + u = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) + u.mem_map(i*0x1000, 5) + u.mem_read(i*0x1000+6, 1) + print hex(i*0x1000) + " succeeeded" + #except unicorn.UcError as e: + # print hex(i*0x1000) + " failed:",e