Skip to content

Commit

Permalink
early test
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Jun 2, 2024
1 parent 733d3ff commit 9c0b4d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/generator/X64Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,17 @@ std::vector<uint8_t> X64HandlerGenerator::handlerBytes(uint64_t address) {
a.mov(FIRST_PARAM, "content");

// call the pre handler, incrementing
a.callip("handlerPre");
// a.callip("handlerPre");

a.mov(m[RBP - 0x10], RAX);

// recover registers
restoreRegisters(a, preservedSize);

// early test
a.pop(RBP);
a.ret();

// call the func
m_metadata.m_convention->generateIntoDefault(a, m_metadata.m_abstract);

Expand Down
14 changes: 7 additions & 7 deletions test/Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST(HookTest, NoHandler) {
TEST(HookTest, NoHooks) {
HandlerHandle handlerHandle;
makeHandler<1>(handlerHandle);
EXPECT_EQ(callFunction<1>(), 2);
EXPECT_EQ(callFunction<1>(), 1);
}

TEST(HookTest, MakeWrapper) {
Expand All @@ -104,20 +104,20 @@ TEST(HookTest, SingleHook) {
HandlerHandle handlerHandle;
makeHandler<3>(handlerHandle);

// makeHook<3>(handlerHandle);
makeHook<3>(handlerHandle);

// EXPECT_EQ(callFunction<3>(), 3);
EXPECT_EQ(callFunction<3>(), 3);
}

// priorityHook -> hook -> function
TEST(HookTest, PriorityHook) {
HandlerHandle handlerHandle;
// makeHandler<4>(handlerHandle);
makeHandler<4>(handlerHandle);

// makeHook<4>(handlerHandle);
// makePriorityHook<4>(handlerHandle);
makeHook<4>(handlerHandle);
makePriorityHook<4>(handlerHandle);

// EXPECT_EQ(callFunction<4>(), 6);
EXPECT_EQ(callFunction<4>(), 6);
}

// priorityHook -> function
Expand Down

0 comments on commit 9c0b4d0

Please sign in to comment.