summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-04-24 03:27:35 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-04-24 03:43:26 +0100
commit7b12eb811ff62d9d14ccb7c152a9821796efe9a5 (patch)
treede95be73de40e732d8bbd002b721b4683fbf12c0 /test
parent99e9a6765a9a358987c062ec4a251f8254581933 (diff)
Replace udis86 with a very small x86 decoder
hook_inline() uses the new x86_len() function to get instruction lengths instead of doing full-blown disassembly, which should be a tiny bit quicker, and also removes the next for about 90KiB of lookup tables and such in the final binary. The code-digging logic in demorecord is also rewritten to be opcode-based rather than mnenmonic based. In general, going forward the plan is to always rely on opcodes and thus avoid a bunch of disassembly work every plugin load. udis86 is still in the tree for now to provide dbg_asmdump(), but it's only compiled into debug builds and left out of releases completely. As such, the whole BSD licence statement is also gone from the distribution LICENCE files. There's now also a dbg_toghidra() which spits out a rebased address to look stuff up for proper reverse engineering, which might be more useful than dbg_asmdump() anyway. If nobody ends up using the latter ever again, udis86 could get chucked completely. We'll see. Also shoehorned into this commit are a couple more forgotten copyright year bumps and some general minor cleanup here and there, because I couldn't be bothered wading through all the diff hunks. Oh, and makebindist.bat now makes an effort to make the zip file timestamps predictable/reproducible. That should be a different commit for sure, but oh well too bad.
Diffstat (limited to 'test')
-rw-r--r--test/bitbuf.test.c2
-rw-r--r--test/hook.test.c8
-rw-r--r--test/kv.test.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/test/bitbuf.test.c b/test/bitbuf.test.c
index 58d1c4d..324a7f6 100644
--- a/test/bitbuf.test.c
+++ b/test/bitbuf.test.c
@@ -14,7 +14,7 @@ static union {
} bb_buf;
static struct bitbuf bb = {bb_buf.buf, 512, 512 * 8, 0, false, false, "test"};
-TEST("The possible UB in bitbuf_appendbuf shouldn't trigger horrible bugs", 0) {
+TEST("The possible UB in bitbuf_appendbuf shouldn't trigger horrible bugs") {
char unalign[3] = {'X', 'X', 'X'};
char _buf[32 + sizeof(bitbuf_cell)];
char *buf = _buf;
diff --git a/test/hook.test.c b/test/hook.test.c
index 50e07a8..b2e841c 100644
--- a/test/hook.test.c
+++ b/test/hook.test.c
@@ -4,7 +4,7 @@
#ifdef _WIN32
-#include "../src/udis86.c"
+#include "../src/x86.c"
#include "../src/hook.c"
#include <stdarg.h>
@@ -32,20 +32,20 @@ static int other_hook(int a, int b) {
return orig_other_function(a, b) + 5;
}
-TEST("Inline hooks should be able to wrap the original function", 0) {
+TEST("Inline hooks should be able to wrap the original function") {
orig_some_function = hook_inline(&some_function, &some_hook);
if (!orig_some_function) return false;
return some_function(5, 5) == 15;
}
-TEST("Inline hooks should be removable again", 0) {
+TEST("Inline hooks should be removable again") {
orig_some_function = hook_inline(&some_function, &some_hook);
if (!orig_some_function) return false;
unhook_inline(orig_some_function);
return some_function(5, 5) == 10;
}
-TEST("Multiple functions should be able to be inline hooked at once", 0) {
+TEST("Multiple functions should be able to be inline hooked at once") {
orig_some_function = hook_inline(&some_function, &some_hook);
if (!orig_some_function) return false;
diff --git a/test/kv.test.c b/test/kv.test.c
index 12f2801..7f82b8a 100644
--- a/test/kv.test.c
+++ b/test/kv.test.c
@@ -33,7 +33,7 @@ Val2// comment\n\
";
static const int sz = sizeof(data) - 1;
-TEST("parsing should work with any buffer size", 0) {
+TEST("parsing should work with any buffer size") {
for (int chunksz = 3; chunksz <= sz; ++chunksz) {
struct kv_parser kvp = {0};
// sending data in chunks to test reentrancy