@@ -12,7 +12,7 @@ static int count = 1;
|
||||
// @address: address where the code is being executed
|
||||
// @size: size of machine instruction being executed
|
||||
// @user_data: user data passed to tracing APIs.
|
||||
void cb_hookblock(struct uc_struct *uc, uint64_t address, uint32_t size, void *user_data) {
|
||||
void cb_hookblock(ucengine *uc, uint64_t address, uint32_t size, void *user_data) {
|
||||
fprintf(stderr, "# >>> Tracing basic block at 0x%llx, block size = 0x%x\n", address, size);
|
||||
if (address != 0x1000000 && address != 0x1000200) {
|
||||
fprintf(stderr, "not ok %d - address != 0x1000000 && address != 0x1000200\n", count++);
|
||||
@@ -27,7 +27,7 @@ void cb_hookblock(struct uc_struct *uc, uint64_t address, uint32_t size, void *u
|
||||
}
|
||||
|
||||
int main() {
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
|
||||
fprintf(stderr, "# basic block callback test\n");
|
||||
fprintf(stderr, "# there are only two basic blocks 0x1000000-0x10001ff and 0x1000200-0x10003ff\n");
|
||||
|
||||
@@ -10,7 +10,7 @@ int main()
|
||||
{
|
||||
int size;
|
||||
uint8_t *buf;
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
||||
if (err) {
|
||||
fprintf (stderr, "Cannot initialize unicorn\n");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uint8_t *buf, *buf2;
|
||||
int i;
|
||||
uc_err err;
|
||||
|
||||
@@ -36,7 +36,7 @@ bits 32
|
||||
*/
|
||||
|
||||
// callback for tracing memory access (READ or WRITE)
|
||||
static bool hook_mem_invalid(struct uc_struct *uc, uc_mem_type type,
|
||||
static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
||||
uint64_t address, int size, int64_t value, void *user_data)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ static bool hook_mem_invalid(struct uc_struct *uc, uc_mem_type type,
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uc_err err;
|
||||
uint32_t eax, ebx;
|
||||
|
||||
@@ -50,7 +50,7 @@ hlt
|
||||
static int log_num = 1;
|
||||
|
||||
// callback for tracing instruction
|
||||
static void hook_code(struct uc_struct *uc, uint64_t addr, uint32_t size, void *user_data)
|
||||
static void hook_code(ucengine *uc, uint64_t addr, uint32_t size, void *user_data)
|
||||
{
|
||||
uint8_t opcode;
|
||||
if (uc_mem_read(uc, addr, &opcode, 1) != UC_ERR_OK) {
|
||||
@@ -74,7 +74,7 @@ static void hook_code(struct uc_struct *uc, uint64_t addr, uint32_t size, void *
|
||||
}
|
||||
|
||||
// callback for tracing memory access (READ or WRITE)
|
||||
static void hook_mem_write(struct uc_struct *uc, uc_mem_type type,
|
||||
static void hook_mem_write(ucengine *uc, uc_mem_type type,
|
||||
uint64_t addr, int size, int64_t value, void *user_data)
|
||||
{
|
||||
printf("# write to memory at 0x%"PRIx64 ", data size = %u, data value = 0x%"PRIx64 "\n", addr, size, value);
|
||||
@@ -89,7 +89,7 @@ static void hook_mem_write(struct uc_struct *uc, uc_mem_type type,
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uc_err err;
|
||||
uint8_t buf1[100], readbuf[100];
|
||||
|
||||
@@ -46,7 +46,7 @@ bottom:
|
||||
*/
|
||||
|
||||
// callback for tracing instruction
|
||||
static void hook_code(struct uc_struct *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
static void hook_code(ucengine *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
{
|
||||
uint32_t esp;
|
||||
printf(">>> Tracing instruction at 0x%"PRIx64 ", instruction size = 0x%x\n", address, size);
|
||||
@@ -57,7 +57,7 @@ static void hook_code(struct uc_struct *uc, uint64_t address, uint32_t size, voi
|
||||
}
|
||||
|
||||
// callback for tracing memory access (READ or WRITE)
|
||||
static bool hook_mem_invalid(struct uc_struct *uc, uc_mem_type type,
|
||||
static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
||||
uint64_t address, int size, int64_t value, void *user_data)
|
||||
{
|
||||
uint32_t esp;
|
||||
@@ -94,7 +94,7 @@ static bool hook_mem_invalid(struct uc_struct *uc, uc_mem_type type,
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uc_err err;
|
||||
uint8_t bytes[8];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
int got_sigill = 0;
|
||||
|
||||
void _interrupt(struct uc_struct *uc, uint32_t intno, void *user_data)
|
||||
void _interrupt(ucengine *uc, uint32_t intno, void *user_data)
|
||||
{
|
||||
if (intno == 6) {
|
||||
uc_emu_stop(uc);
|
||||
@@ -20,7 +20,7 @@ int main()
|
||||
{
|
||||
int size;
|
||||
uint8_t *buf;
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_hook_h uh_trap;
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
||||
if (err) {
|
||||
|
||||
@@ -10,7 +10,7 @@ int main()
|
||||
{
|
||||
int size;
|
||||
uint8_t *buf;
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
||||
if (err) {
|
||||
|
||||
@@ -24,19 +24,19 @@ https://github.com/unicorn-engine/unicorn/issues/78
|
||||
// number of seconds to wait before timeout
|
||||
#define TIMEOUT 5
|
||||
|
||||
static void hook_block(struct uc_struct *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
static void hook_block(ucengine *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
{
|
||||
printf(">>> Tracing basic block at 0x%"PRIx64 ", block size = 0x%x\n", address, size);
|
||||
}
|
||||
|
||||
static void hook_code(struct uc_struct *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
static void hook_code(ucengine *uc, uint64_t address, uint32_t size, void *user_data)
|
||||
{
|
||||
printf(">>> Tracing instruction at 0x%"PRIx64 ", instruction size = 0x%x\n", address, size);
|
||||
}
|
||||
|
||||
static void test_arm(void)
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
|
||||
@@ -92,7 +92,7 @@ static void test_arm(void)
|
||||
|
||||
static void test_thumb(void)
|
||||
{
|
||||
struct uc_struct *uc;
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user