| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame^] | 1 | #include <sys/types.h> |
| 2 | #include <sys/ptrace.h> | ||||
| 3 | |||||
| 4 | int get_instruction_pointer(pid_t pid) | ||||
| 5 | { | ||||
| 6 | return ptrace(PTRACE_PEEKUSER, pid, 4*EIP, 0); | ||||
| 7 | } | ||||
| 8 | |||||
| 9 | int get_stack_pointer(pid_t pid) | ||||
| 10 | { | ||||
| 11 | return ptrace(PTRACE_PEEKUSER, pid, 4*UESP, 0); | ||||
| 12 | } | ||||
| 13 | |||||
| 14 | int get_return_addr(pid_t pid, void * stack_pointer) | ||||
| 15 | { | ||||
| 16 | return ptrace(PTRACE_PEEKTEXT, pid, stack_pointer, 0); | ||||
| 17 | } | ||||
| 18 | |||||