Skip to content

Instantly share code, notes, and snippets.

@0x75
Created June 26, 2013 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x75/5868699 to your computer and use it in GitHub Desktop.
Save 0x75/5868699 to your computer and use it in GitHub Desktop.
BP Routine
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