4 #include <sys/ptrace.h>
5 #include <asm/ptrace.h>
9 #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR))
10 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
13 #if (!defined(PTRACE_POKEUSER) && defined(PTRACE_POKEUSR))
14 # define PTRACE_POKEUSER PTRACE_POKEUSR
22 get_instruction_pointer(Process *proc) {
23 return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_pc, 0);
27 set_instruction_pointer(Process *proc, void *addr) {
28 ptrace(PTRACE_POKEUSER, proc->pid, off_pc, addr);
32 get_stack_pointer(Process *proc) {
33 return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_sp, 0);
36 /* really, this is given the *stack_pointer expecting
37 * a CISC architecture; in our case, we don't need that */
39 get_return_addr(Process *proc, void *stack_pointer) {
40 long addr = ptrace(PTRACE_PEEKUSER, proc->pid, off_lr, 0);
42 proc->thumb_mode = addr & 1;
49 set_return_addr(Process *proc, void *addr) {
50 ptrace(PTRACE_POKEUSER, proc->pid, off_lr, addr);