blob: 250e5110535ac47c198eff029f805dc5f43c9397 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/ptrace.h>
#include "ltrace.h"
void insert_breakpoint(pid_t pid, struct breakpoint * sbp)
{
unsigned long a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
*(unsigned long *)sbp->orig_value = a;
a = ((0x91 * 256 + 0xd0) * 256 + 0x20) * 256 + 0x01;
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
void delete_breakpoint(pid_t pid, struct breakpoint * sbp)
{
ptrace(PTRACE_POKETEXT, pid, sbp->addr, *(long *)sbp->orig_value);
}
|