| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame^] | 1 | #include <sys/ptrace.h> |
| 2 | #include "ltrace.h" |
| 3 | |
| 4 | void insert_breakpoint(int pid, struct breakpoint * sbp) |
| 5 | { |
| 6 | unsigned long a; |
| 7 | |
| 8 | a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0); |
| 9 | *(unsigned long *)sbp->orig_value = a; |
| 10 | a = ((0x91 * 256 + 0xd0) * 256 + 0x20) * 256 + 0x01; |
| 11 | ptrace(PTRACE_POKETEXT, pid, sbp->addr, a); |
| 12 | } |
| 13 | |
| 14 | void delete_breakpoint(int pid, struct breakpoint * sbp) |
| 15 | { |
| 16 | ptrace(PTRACE_POKETEXT, pid, sbp->addr, *(long *)sbp->orig_value); |
| 17 | } |