blob: c0a700b35bfdb4ecd2ffdc877b24adf8f536ad80 [file] [log] [blame]
Juan Cespedes5e01f651998-03-08 22:31:44 +01001#include <sys/ptrace.h>
2#include "ltrace.h"
3
4void 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
14void delete_breakpoint(int pid, struct breakpoint * sbp)
15{
16 ptrace(PTRACE_POKETEXT, pid, sbp->addr, *(long *)sbp->orig_value);
17}