Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
wtdcode committed Jan 18, 2025
1 parent a0fa2c1 commit ab56572
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion include/unicorn/unicorn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added tests/regress/x86_vex
Binary file not shown.
29 changes: 15 additions & 14 deletions tests/unit/test_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
16 changes: 9 additions & 7 deletions tests/unit/test_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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);
Expand Down

0 comments on commit ab56572

Please sign in to comment.