Created
June 26, 2013 16:01
-
-
Save 0x75/5868699 to your computer and use it in GitHub Desktop.
BP Routine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int SetBreakPoint(uint64_t Address) { | |
BPID++; | |
Breakpoint B; | |
B.ID = BPID; | |
B.address = Address; | |
B.active = true; | |
B.max_hits = -1; | |
B.description = ""; | |
B.BP_Inst = REGULAR; | |
B.Orig_Inst = 0; | |
B.hitcount = 0; | |
mach_vm_size_t nread; | |
mach_vm_read_overwrite(targetTask, B.address, 1, (mach_vm_address_t) &B.Orig_Inst, &nread); | |
printf("mach_vm_read_overwrite() %i bytes from memory (0x%x)\n", nread, B.Orig_Inst); | |
mach_vm_write(targetTask, B.address, (vm_offset_t) 0xCC, 1); | |
char byte; | |
mach_vm_read_overwrite(targetTask, B.address, 1, (mach_vm_address_t) &byte, &nread); | |
if (byte == 0xCC) | |
printf("success\n"); | |
else | |
printf("0x%x - 0x%x\n", byte, 0xCC); | |
return B.ID; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment