Commit Graph

466 Commits

Author SHA1 Message Date
Nguyen Anh Quynh
2599d41404 add some hooking macros for all kind of memory access events 2015-09-24 19:21:31 +08:00
Nguyen Anh Quynh
738b8d89f9 correct instructions for uc_cb_hookmem_t & uc_cb_eventmem_t. this fixes a part of issue #151 2015-09-24 18:50:49 +08:00
Nguyen Anh Quynh
e0dceb95da Merge pull request #150 from lunixbochs/master
update Go bindings for #149
2015-09-24 18:45:51 +08:00
Ryan Hileman
eb19d9bff5 update Go bindings for #149 2015-09-24 01:01:39 -07:00
Nguyen Anh Quynh
90eb8f2e72 This commit continues the PR #111
- Allow to register handler separately for invalid memory access
- Add new memory events for hooking:
   - UC_MEM_READ_INVALID, UC_MEM_WRITE_INVALID, UC_MEM_FETCH_INVALID
   - UC_HOOK_MEM_READ_PROT, UC_HOOK_MEM_WRITE_PROT, UC_HOOK_MEM_FETCH_PROT
- Rename UC_ERR_EXEC_PROT to UC_ERR_FETCH_PROT
- Change API uc_hook_add() so event type @type can be combined from hooking types
2015-09-24 14:18:02 +08:00
Nguyen Anh Quynh
e479f72403 update .gitignore 2015-09-24 13:52:10 +08:00
Sean Heelan
dfb4a9d9ad Revert "Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t"
As pointed out by aquynh the return types are actually different. A
uc_cb_eventmem_t callback returns a bool, while uc_cb_hookmem_t has a
void return type.

This reverts commit cb2b97f26c.
2015-09-23 12:51:47 +07:00
Sean Heelan
2ef59e5727 Renamed UC_HOOK_MEM_INVALID_[READ/WRITE/FETCH] to
UC_HOOK_MEM_[READ/WRITE/FETCH]_INVALID as per aquynh's feedback.
2015-09-23 12:48:13 +07:00
Sean Heelan
cb2b97f26c Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t, as per
issue #111
2015-09-22 12:37:05 +07:00
Sean Heelan
75c5904ec1 Makes the hook types consistent, with a single indicator for each of
read, write and fetch.

This commit only adds the enum values. The functionality still has to be
updated.

As per issue #111
2015-09-22 12:26:01 +07:00
Nguyen Anh Quynh
734aa15fa6 correct supported archs in COMPILE.TXT 2015-09-22 12:12:17 +08:00
Nguyen Anh Quynh
14a01b5186 mips: handle delay slot so do not duplicate calling instruction handler. this fixes issue #133 2015-09-22 11:59:53 +08:00
Nguyen Anh Quynh
80c316026f update .gitignore 2015-09-22 11:05:38 +08:00
Nguyen Anh Quynh
a853eb6363 mips, m68k: early check to see if the address of BB is the until address 2015-09-22 10:24:26 +08:00
danghvu
242713ce64 Missing update on make test clean 2015-09-21 21:04:20 -05:00
Nguyen Anh Quynh
25342d71d1 m68k -> M68K, x86 -> X86 2015-09-22 10:00:05 +08:00
Nguyen Anh Quynh
7d8d044b5e Merge pull request #145 from JonathonReinhart/update-readme
change README to markdown, minor edits
2015-09-22 09:58:23 +08:00
danghvu
3c1d65ea66 Reorganize test directories 2015-09-21 20:47:45 -05:00
danghvu
0c67f41ed9 Fix issue #118 2015-09-21 20:30:05 -05:00
Nguyen Anh Quynh
f9dc4dcede test: fix test_x86_64() 2015-09-21 22:56:53 +08:00
Nguyen Anh Quynh
26ee533303 return NULL in memory_mapping() if no memory is mapped. this fixes test_bad_unmap in test_x86.c 2015-09-21 22:17:26 +08:00
Nguyen Anh Quynh
441d15e314 test: correct the input code for test_i386_invalid_mem_read() 2015-09-21 21:45:32 +08:00
Nguyen Anh Quynh
d8c3b44cb6 Merge branch 'unit-testing-framework' of https://github.com/JonathonReinhart/unicorn into JonathonReinhart-unit-testing-framework 2015-09-21 21:08:00 +08:00
Jonathon Reinhart
163e9020c8 test/unit: add test_sanity
This test ensures that the custom uc_assert_xxx() macros are working
as intended.
2015-09-21 08:37:27 -04:00
Jonathon Reinhart
02daa8df46 test/unit: simplify uc_assert_fail() macro
This removes the UC_ASSERT_ERR_ANY constant, which was causing a
compilation error on OSX:

error: comparison of constant 3735928559 with expression of type
'uc_err' (aka 'enum uc_err') is always true
[-Werror,-Wtautological-constant-out-of-range-compare]

I could have probably changed 0xDEADBEEF to a constant < 0x80000000
but this seems cleaner anyway.
2015-09-21 08:37:21 -04:00
Nguyen Anh Quynh
47b904c3ba Merge pull request #139 from JonathonReinhart/unit-testing-framework
[WIP] Unit testing framework
2015-09-21 11:18:59 +08:00
Jonathon Reinhart
07122809b5 test/unit: add test_basic_blocks
This verifies that the basic block callback is working as expected.
2015-09-20 22:45:45 -04:00
Nguyen Anh Quynh
d7d4be25b1 arm64: early check to see if the address of this block is the until address 2015-09-21 10:26:33 +08:00
Jonathon Reinhart
cc1cfb9141 add information about unit tests to COMPILE.txt 2015-09-20 22:16:48 -04:00
Jonathon Reinhart
1be8ef69c8 add 'test' to main Makefile 2015-09-20 22:16:48 -04:00
Jonathon Reinhart
46ee860084 update to new error constants and silence printfs 2015-09-20 22:16:48 -04:00
Jonathon Reinhart
f225584f77 change README to markdown, minor edits 2015-09-20 22:10:51 -04:00
Jonathon Reinhart
7a98fc4e78 add tests to test_x86.c from samples/ 2015-09-20 21:13:22 -04:00
Jonathon Reinhart
c026c23efb add more mem map API tests 2015-09-20 21:13:22 -04:00
Jonathon Reinhart
4dae31b25e add uc_assert_(err|fail) macros 2015-09-20 21:13:22 -04:00
Jonathon Reinhart
df3966a90c continued work on test framework 2015-09-20 21:13:22 -04:00
Jonathon Reinhart
d4de54601d add start of test_mem_map.c 2015-09-20 21:13:22 -04:00
Jonathon Reinhart
12909e6a4c add basic cmocka unit test 2015-09-20 21:13:22 -04:00
Nguyen Anh Quynh
ad835459bd fix conflicts when merging new_regress to master 2015-09-20 00:21:20 +07:00
Nguyen Anh Quynh
9aa04d9496 tb_gen_code(): only check to link next page if tb->size > 0 (so we skip empty block) 2015-09-20 00:05:17 +07:00
Nguyen Anh Quynh
7ab8d667fd fix regress/fpu_mem_write.py so it really emulates code 2015-09-20 00:02:30 +07:00
Nguyen Anh Quynh
4d45f11a08 regress/regress.py can be run from inside regress/ 2015-09-19 17:06:50 +07:00
danghvu
cbb2cf3618 Regress python testcases must define expected value via unittest 2015-09-17 15:45:15 -05:00
danghvu
8c163706e4 Fix issue #113, untracked reference 2015-09-16 21:33:01 -05:00
Nguyen Anh Quynh
5005b4a6e2 arm: early check to see if the address of this block is the until address 2015-09-17 09:16:57 +07:00
Nguyen Anh Quynh
d6b9c31dc9 sparc: more cleanup 2015-09-16 16:04:12 +07:00
Nguyen Anh Quynh
f36bd83f85 cleanup regress/sparc*.py 2015-09-16 15:46:10 +07:00
mothran
893e6abcbd first atttempt at SPARC64 fixes, no longer SEGV's, set CPU model to: Sun UltraSparc IV 2015-09-15 23:12:03 -07:00
Nguyen Anh Quynh
fe807952d0 bindings: update Sparc registers after the last core change 2015-09-15 14:17:57 +07:00
Nguyen Anh Quynh
e581b8ea0e Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-09-15 14:17:10 +07:00