From ab565729e7cab6a4b1b09b966ccaf2f2fa306f40 Mon Sep 17 00:00:00 2001 From: lazymio Date: Sat, 18 Jan 2025 15:18:49 +0800 Subject: [PATCH] Format code --- include/unicorn/unicorn.h | 2 +- tests/regress/x86_vex | Bin 0 -> 34136 bytes tests/unit/test_ctl.c | 29 +++++++++++++++-------------- tests/unit/test_x86.c | 16 +++++++++------- 4 files changed, 25 insertions(+), 22 deletions(-) create mode 100755 tests/regress/x86_vex diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index 1ee78f3aa1..c057dcc964 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -65,7 +65,7 @@ typedef size_t uc_hook; #define UNICORN_DEPRECATED __declspec(deprecated) #else #pragma message( \ - "WARNING: You need to implement UNICORN_DEPRECATED for this compiler") + "WARNING: You need to implement UNICORN_DEPRECATED for this compiler") #define UNICORN_DEPRECATED #endif diff --git a/tests/regress/x86_vex b/tests/regress/x86_vex new file mode 100755 index 0000000000000000000000000000000000000000..62d95ab8763db64023b0a7f322a1e8e3db15f0bd GIT binary patch literal 34136 zcmeI5du&tJ9mmhLP2xak0<8*!LEN(OEFtAlf*OhwlMXi8(2#C{Hn{}HAudS_wnIWw z6%!XVP_;`0XsDE7qG^qxtY|~4J&7$nTBoIunnXq1q5Ql{gF(Kx_Ho;_hYsoju zc9d0=Q|j2DR34j@=21Hzp`a{RmQ_`b%~tB$$EFF*pMqrFsDv#0U2T4fsUfw!oom#= zWM`@Q4kH)Lv@14+%CHt+N#^ zKJSV~_pTLn2O8_(QfU;<2l2`~XB zzyz286JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C0!)AjFaajO1egF5U;<2l2`~XB zzyz286JP>NfC(@GCcp&#djj|RMQpg;6dn$WZmS4XBr-+xm;L#XP%uAobDBsFW{M=v zt{lf1hU4)}dvv(HG>kgkeP;Q_J%=TB*OL<-ZqE%5n=Pm>E?TGClZmw=sl>DFNvmW} z_6FzQ?tHSNqSuiZvC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mY{ni=ne_G zKZ5R#AXc;%>3{EYU_?YOOLtJv{S*I59UE3j`m|sfU|RlvmYh81?h(yXZVI{cNp>G* zi0)z0*T4fv!~97BVFEFeGM77%Uj?H8%)vgJNkOcpO!}FnUEv`l?amW%_Vkt+o}Zss z)<2wkXx&e*Y|FlO^py*3Vrp07siHIPCC4rteCH=so-4QN`z*hU#rBxWtESw0>C#It z9{&C1*ESt_ Y(~+)Q8R1fC>49@s->a;NT_T+S1{>c(761SM literal 0 HcmV?d00001 diff --git a/tests/unit/test_ctl.c b/tests/unit/test_ctl.c index 9e2b4a4dee..3da761b5ae 100644 --- a/tests/unit/test_ctl.c +++ b/tests/unit/test_ctl.c @@ -428,21 +428,22 @@ static void test_noexec(void) OK(uc_close(uc)); } -TEST_LIST = {{"test_uc_ctl_mode", test_uc_ctl_mode}, - {"test_uc_ctl_page_size", test_uc_ctl_page_size}, - {"test_uc_ctl_arch", test_uc_ctl_arch}, - {"test_uc_ctl_time_out", test_uc_ctl_time_out}, - {"test_uc_ctl_exits", test_uc_ctl_exits}, - {"test_uc_ctl_tb_cache", test_uc_ctl_tb_cache}, +TEST_LIST = { + {"test_uc_ctl_mode", test_uc_ctl_mode}, + {"test_uc_ctl_page_size", test_uc_ctl_page_size}, + {"test_uc_ctl_arch", test_uc_ctl_arch}, + {"test_uc_ctl_time_out", test_uc_ctl_time_out}, + {"test_uc_ctl_exits", test_uc_ctl_exits}, + {"test_uc_ctl_tb_cache", test_uc_ctl_tb_cache}, #ifdef UNICORN_HAS_ARM - {"test_uc_ctl_change_page_size", test_uc_ctl_change_page_size}, - {"test_uc_ctl_arm_cpu", test_uc_ctl_arm_cpu}, + {"test_uc_ctl_change_page_size", test_uc_ctl_change_page_size}, + {"test_uc_ctl_arm_cpu", test_uc_ctl_arm_cpu}, #endif #ifdef UNICORN_HAS_ARM64 - {"test_uc_ctl_change_page_size_arm64", test_uc_ctl_change_page_size_arm64}, + {"test_uc_ctl_change_page_size_arm64", test_uc_ctl_change_page_size_arm64}, #endif - {"test_uc_hook_cached_uaf", test_uc_hook_cached_uaf}, - {"test_uc_emu_stop_set_ip", test_uc_emu_stop_set_ip}, - {"test_tlb_clear", test_tlb_clear}, - {"test_noexec", test_noexec}, - {NULL, NULL}}; + {"test_uc_hook_cached_uaf", test_uc_hook_cached_uaf}, + {"test_uc_emu_stop_set_ip", test_uc_emu_stop_set_ip}, + {"test_tlb_clear", test_tlb_clear}, + {"test_noexec", test_noexec}, + {NULL, NULL}}; diff --git a/tests/unit/test_x86.c b/tests/unit/test_x86.c index 13f03e7c04..59d0408aab 100644 --- a/tests/unit/test_x86.c +++ b/tests/unit/test_x86.c @@ -61,8 +61,8 @@ static void QuickTest_run(QuickTest *test) uint64_t value = 0; OK(uc_reg_read(uc, out->reg, &value)); acutest_check_(value == out->value, out->file, out->line, - "OUT_REG(%s, 0x%" PRIx64 ") = 0x%"PRIx64"", out->name, - out->value, value); + "OUT_REG(%s, 0x%" PRIx64 ") = 0x%" PRIx64 "", + out->name, out->value, value); } else { uint32_t value = 0; OK(uc_reg_read(uc, out->reg, &value)); @@ -2019,7 +2019,8 @@ static void test_x86_hook_insn_rdtscp(void) OK(uc_close(uc)); } -static void test_x86_dr7() { +static void test_x86_dr7() +{ uc_engine *uc; char code[] = "\x48\xC7\xC0\x05\x00\x01\x00\x0F\x23\xF8"; // mov rax, 0x10005 @@ -2031,14 +2032,14 @@ static void test_x86_dr7() { } static void test_x86_hook_block_cb(uc_engine *uc, uint64_t address, - uint32_t size, void *user_data) + uint32_t size, void *user_data) { uint32_t pc; - OK(uc_reg_read(uc, UC_X86_REG_EIP, (void*)&pc)); + OK(uc_reg_read(uc, UC_X86_REG_EIP, (void *)&pc)); TEST_CHECK(pc == address); - *((uint64_t*)user_data) += 1; + *((uint64_t *)user_data) += 1; } static void test_x86_hook_block() @@ -2051,7 +2052,8 @@ static void test_x86_hook_block() uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1); - OK(uc_hook_add(uc, &hk, UC_HOOK_BLOCK, test_x86_hook_block_cb, (void*)&cnt, 1, 0)); + OK(uc_hook_add(uc, &hk, UC_HOOK_BLOCK, test_x86_hook_block_cb, (void *)&cnt, + 1, 0)); OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0)); TEST_CHECK(cnt == 2);