Format code

This commit is contained in:
2025-01-18 15:18:49 +08:00
parent a0fa2c1249
commit ab565729e7
4 changed files with 25 additions and 22 deletions

View File

@@ -65,7 +65,7 @@ typedef size_t uc_hook;
#define UNICORN_DEPRECATED __declspec(deprecated) #define UNICORN_DEPRECATED __declspec(deprecated)
#else #else
#pragma message( \ #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 #define UNICORN_DEPRECATED
#endif #endif

BIN
tests/regress/x86_vex Executable file

Binary file not shown.

View File

@@ -428,21 +428,22 @@ static void test_noexec(void)
OK(uc_close(uc)); OK(uc_close(uc));
} }
TEST_LIST = {{"test_uc_ctl_mode", test_uc_ctl_mode}, TEST_LIST = {
{"test_uc_ctl_page_size", test_uc_ctl_page_size}, {"test_uc_ctl_mode", test_uc_ctl_mode},
{"test_uc_ctl_arch", test_uc_ctl_arch}, {"test_uc_ctl_page_size", test_uc_ctl_page_size},
{"test_uc_ctl_time_out", test_uc_ctl_time_out}, {"test_uc_ctl_arch", test_uc_ctl_arch},
{"test_uc_ctl_exits", test_uc_ctl_exits}, {"test_uc_ctl_time_out", test_uc_ctl_time_out},
{"test_uc_ctl_tb_cache", test_uc_ctl_tb_cache}, {"test_uc_ctl_exits", test_uc_ctl_exits},
{"test_uc_ctl_tb_cache", test_uc_ctl_tb_cache},
#ifdef UNICORN_HAS_ARM #ifdef UNICORN_HAS_ARM
{"test_uc_ctl_change_page_size", test_uc_ctl_change_page_size}, {"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_arm_cpu", test_uc_ctl_arm_cpu},
#endif #endif
#ifdef UNICORN_HAS_ARM64 #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 #endif
{"test_uc_hook_cached_uaf", test_uc_hook_cached_uaf}, {"test_uc_hook_cached_uaf", test_uc_hook_cached_uaf},
{"test_uc_emu_stop_set_ip", test_uc_emu_stop_set_ip}, {"test_uc_emu_stop_set_ip", test_uc_emu_stop_set_ip},
{"test_tlb_clear", test_tlb_clear}, {"test_tlb_clear", test_tlb_clear},
{"test_noexec", test_noexec}, {"test_noexec", test_noexec},
{NULL, NULL}}; {NULL, NULL}};

View File

@@ -61,8 +61,8 @@ static void QuickTest_run(QuickTest *test)
uint64_t value = 0; uint64_t value = 0;
OK(uc_reg_read(uc, out->reg, &value)); OK(uc_reg_read(uc, out->reg, &value));
acutest_check_(value == out->value, out->file, out->line, acutest_check_(value == out->value, out->file, out->line,
"OUT_REG(%s, 0x%" PRIx64 ") = 0x%"PRIx64"", out->name, "OUT_REG(%s, 0x%" PRIx64 ") = 0x%" PRIx64 "",
out->value, value); out->name, out->value, value);
} else { } else {
uint32_t value = 0; uint32_t value = 0;
OK(uc_reg_read(uc, out->reg, &value)); OK(uc_reg_read(uc, out->reg, &value));
@@ -2019,7 +2019,8 @@ static void test_x86_hook_insn_rdtscp(void)
OK(uc_close(uc)); OK(uc_close(uc));
} }
static void test_x86_dr7() { static void test_x86_dr7()
{
uc_engine *uc; uc_engine *uc;
char code[] = char code[] =
"\x48\xC7\xC0\x05\x00\x01\x00\x0F\x23\xF8"; // mov rax, 0x10005 "\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, 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; 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); TEST_CHECK(pc == address);
*((uint64_t*)user_data) += 1; *((uint64_t *)user_data) += 1;
} }
static void test_x86_hook_block() 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); 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)); OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0));
TEST_CHECK(cnt == 2); TEST_CHECK(cnt == 2);