81 lines
2.7 KiB
Diff
81 lines
2.7 KiB
Diff
|
This patch removes the angr dependency from the pyvex these, thus
|
||
|
resolving a circular dependency (as angr depends on pyvex). This
|
||
|
patch has been taken from upstream.
|
||
|
|
||
|
This patch is a squashed version of the following upstream patches:
|
||
|
|
||
|
* https://github.com/angr/pyvex/commit/61fb26f223a8d8a276b702d2448a12e02c5c9c6b
|
||
|
* https://github.com/angr/pyvex/commit/a1fb2a4d0826b0e43bd8bbdd00b6db032643ec95
|
||
|
|
||
|
diff --git a/tests/test_spotter.py b/tests/test_spotter.py
|
||
|
index 9271ccd..bed7dd4 100644
|
||
|
--- a/tests/test_spotter.py
|
||
|
+++ b/tests/test_spotter.py
|
||
|
@@ -1,6 +1,5 @@
|
||
|
import os
|
||
|
|
||
|
-import angr
|
||
|
import archinfo
|
||
|
|
||
|
import pyvex
|
||
|
@@ -98,53 +97,28 @@ class CortexSpotter(GymratLifter):
|
||
|
register(CortexSpotter, "ARMEL")
|
||
|
|
||
|
|
||
|
-def test_full_binary():
|
||
|
- p = angr.Project(
|
||
|
- os.path.join(test_location, "armel", "RTOSDemo.axf.issue_685"),
|
||
|
- arch="ARMEL",
|
||
|
- auto_load_libs=False,
|
||
|
- )
|
||
|
- st = p.factory.call_state(0x000013CE + 1)
|
||
|
- b = st.block().vex
|
||
|
- simgr = p.factory.simulation_manager(st)
|
||
|
- simgr.step()
|
||
|
- assert b.jumpkind == "Ijk_Sys_syscall"
|
||
|
- assert simgr.active[0].regs.ip_at_syscall.args[0] == 0x13FB
|
||
|
-
|
||
|
-
|
||
|
def test_tmrs():
|
||
|
- test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
|
||
|
- p = angr.Project(
|
||
|
- os.path.join(test_location, "armel", "helloworld"),
|
||
|
- arch="ARMEL",
|
||
|
- auto_load_libs=False,
|
||
|
- )
|
||
|
+ arch = archinfo.arch_from_id("ARMEL")
|
||
|
ins = b"\xef\xf3\x08\x82"
|
||
|
- b = pyvex.block.IRSB(ins, 1, p.arch)
|
||
|
+ b = pyvex.block.IRSB(ins, 1, arch)
|
||
|
assert b.jumpkind == "Ijk_Boring"
|
||
|
assert type(b.statements[1].data) == pyvex.expr.Get
|
||
|
- assert p.arch.register_names.get(b.statements[1].data.offset, "") == "sp"
|
||
|
+ assert arch.register_names.get(b.statements[1].data.offset, "") == "sp"
|
||
|
assert type(b.statements[2]) == pyvex.stmt.Put
|
||
|
|
||
|
|
||
|
def test_tmsr():
|
||
|
- test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
|
||
|
- p = angr.Project(
|
||
|
- os.path.join(test_location, "armel", "helloworld"),
|
||
|
- arch="ARMEL",
|
||
|
- auto_load_libs=False,
|
||
|
- )
|
||
|
+ arch = archinfo.arch_from_id("ARMEL")
|
||
|
inss = b"\x82\xf3\x08\x88"
|
||
|
- b = pyvex.block.IRSB(inss, 1, p.arch, opt_level=3)
|
||
|
+ b = pyvex.block.IRSB(inss, 1, arch, opt_level=3)
|
||
|
assert b.jumpkind == "Ijk_Boring"
|
||
|
assert type(b.statements[1].data) == pyvex.expr.Get
|
||
|
- assert p.arch.register_names.get(b.statements[1].data.offset, "") == "r2"
|
||
|
+ assert arch.register_names.get(b.statements[1].data.offset, "") == "r2"
|
||
|
assert type(b.statements[2]) == pyvex.stmt.Put
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
test_basic()
|
||
|
test_embedded()
|
||
|
- test_full_binary()
|
||
|
test_tmrs()
|
||
|
test_tmsr()
|