You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,15 @@ Create an instance of SimpleDebugger like so:
13
13
SimpleDebugger *debugger = new SimpleDebugger();
14
14
```
15
15
16
+
## Hook functions
17
+
18
+
Hook functions using the `hookFunction(void *originalFunc, void *newFunc)` method. The originalFunction must be at
19
+
least 5 instructions long, if not you will get undefined behavior.
20
+
21
+
After the hook is added all calls to originalFunc will go to newFunc. Make sure the signature for newFunc exactly
22
+
matches originalFunc. Once a hook is added it is active for the lifetime of the process. There is not a way to
23
+
call the original function from the hooked function.
24
+
16
25
## Set breakpoints
17
26
18
27
Set breakpoints using the `setBreakpoint(vm_address_t address)` method. The provided address must be in the __TEXT/__text section (the memory region containing executable code).
SimpleDebugger overwrites instructions with a break instruction by modifying the vm protection of the memory address to be writeable. The original instruction is stored in a table and written back after the breakpoint is hit. Break instructions are handled with a mach exception server.
0 commit comments