From 9a2a5b15d8ae1e65a58b066d8b585a7e6fa77bec Mon Sep 17 00:00:00 2001 From: Hoang-Vu Dang Date: Tue, 5 Jul 2016 11:10:39 -0500 Subject: [PATCH] Rename unhandled CPU exception --- bindings/dotnet/UnicornManaged/Const/Common.fs | 2 +- bindings/go/unicorn/unicorn_const.go | 2 +- bindings/java/unicorn/UnicornConst.java | 2 +- bindings/python/unicorn/unicorn_const.py | 2 +- include/unicorn/unicorn.h | 2 +- qemu/cpu-exec.c | 2 +- tests/regress/mov_gs_eax.py | 2 +- uc.c | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bindings/dotnet/UnicornManaged/Const/Common.fs b/bindings/dotnet/UnicornManaged/Const/Common.fs index cfbe2216..899ab8b0 100644 --- a/bindings/dotnet/UnicornManaged/Const/Common.fs +++ b/bindings/dotnet/UnicornManaged/Const/Common.fs @@ -63,7 +63,7 @@ module Common = let UC_ERR_FETCH_UNALIGNED = 18 let UC_ERR_HOOK_EXIST = 19 let UC_ERR_RESOURCE = 20 - let UC_ERR_UNHANDLED_INTERRUPT = 21 + let UC_ERR_EXCEPTION = 21 let UC_MEM_READ = 16 let UC_MEM_WRITE = 17 let UC_MEM_FETCH = 18 diff --git a/bindings/go/unicorn/unicorn_const.go b/bindings/go/unicorn/unicorn_const.go index 60fb2ab6..c1a4f063 100644 --- a/bindings/go/unicorn/unicorn_const.go +++ b/bindings/go/unicorn/unicorn_const.go @@ -58,7 +58,7 @@ const ( ERR_FETCH_UNALIGNED = 18 ERR_HOOK_EXIST = 19 ERR_RESOURCE = 20 - ERR_UNHANDLED_INTERRUPT = 21 + ERR_EXCEPTION = 21 MEM_READ = 16 MEM_WRITE = 17 MEM_FETCH = 18 diff --git a/bindings/java/unicorn/UnicornConst.java b/bindings/java/unicorn/UnicornConst.java index 0b60e6df..aec3bf9c 100644 --- a/bindings/java/unicorn/UnicornConst.java +++ b/bindings/java/unicorn/UnicornConst.java @@ -60,7 +60,7 @@ public interface UnicornConst { public static final int UC_ERR_FETCH_UNALIGNED = 18; public static final int UC_ERR_HOOK_EXIST = 19; public static final int UC_ERR_RESOURCE = 20; - public static final int UC_ERR_UNHANDLED_INTERRUPT = 21; + public static final int UC_ERR_EXCEPTION = 21; public static final int UC_MEM_READ = 16; public static final int UC_MEM_WRITE = 17; public static final int UC_MEM_FETCH = 18; diff --git a/bindings/python/unicorn/unicorn_const.py b/bindings/python/unicorn/unicorn_const.py index e99ae6c1..34d43210 100644 --- a/bindings/python/unicorn/unicorn_const.py +++ b/bindings/python/unicorn/unicorn_const.py @@ -56,7 +56,7 @@ UC_ERR_WRITE_UNALIGNED = 17 UC_ERR_FETCH_UNALIGNED = 18 UC_ERR_HOOK_EXIST = 19 UC_ERR_RESOURCE = 20 -UC_ERR_UNHANDLED_INTERRUPT = 21 +UC_ERR_EXCEPTION = 21 UC_MEM_READ = 16 UC_MEM_WRITE = 17 UC_MEM_FETCH = 18 diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index caf3e953..4619c7c3 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -145,7 +145,7 @@ typedef enum uc_err { UC_ERR_FETCH_UNALIGNED, // Unaligned fetch UC_ERR_HOOK_EXIST, // hook for this event already existed UC_ERR_RESOURCE, // Insufficient resource: uc_emu_start() - UC_ERR_UNHANDLED_INTERRUPT // Unhandled CPU interrupt. + UC_ERR_EXCEPTION // Unhandled CPU exception } uc_err; diff --git a/qemu/cpu-exec.c b/qemu/cpu-exec.c index 8c4dccae..61b11f30 100644 --- a/qemu/cpu-exec.c +++ b/qemu/cpu-exec.c @@ -139,7 +139,7 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq // Unicorn: If un-catched interrupt, stop executions. if (!catched) { cpu->halted = 1; - uc->invalid_error = UC_ERR_UNHANDLED_INTERRUPT; + uc->invalid_error = UC_ERR_EXCEPTION; ret = EXCP_HLT; break; } diff --git a/tests/regress/mov_gs_eax.py b/tests/regress/mov_gs_eax.py index dbc48f0a..fe381eb2 100755 --- a/tests/regress/mov_gs_eax.py +++ b/tests/regress/mov_gs_eax.py @@ -18,7 +18,7 @@ class VldrPcInsn(regress.RegressTest): with self.assertRaises(UcError) as ex_ctx: uc.emu_start(0x1000, 0x1000 + len(code)) - self.assertEquals(ex_ctx.exception.errno, UC_ERR_UNHANDLED_INTERRUPT) + self.assertEquals(ex_ctx.exception.errno, UC_ERR_EXCEPTION) if __name__ == '__main__': regress.main() diff --git a/uc.c b/uc.c index b6d40ce8..b9fe5654 100644 --- a/uc.c +++ b/uc.c @@ -96,8 +96,8 @@ const char *uc_strerror(uc_err code) return "Fetch from unaligned memory (UC_ERR_FETCH_UNALIGNED)"; case UC_ERR_RESOURCE: return "Insufficient resource (UC_ERR_RESOURCE)"; - case UC_ERR_UNHANDLED_INTERRUPT: - return "Unhandled machine interrupt (UC_ERR_UNHANDLED_INTERRUPT)"; + case UC_ERR_EXCEPTION: + return "Unhandled CPU exception (UC_ERR_EXCEPTION)"; } }