Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 49 lines (41 sloc) 1.432 kb
648ff26 @nelhage Start to separate ptrace.c into a library.
authored
1 #include <sys/ptrace.h>
2 #include <sys/user.h>
3 #include <unistd.h>
4
35d826e @nelhage Implement memcpy to/from child.
authored
5 #ifdef __amd64__
6 #include "arch/amd64.h"
7 #else
8 #include "arch/i386.h"
9 #endif
10
11 #ifndef mmap_syscall
12 #define mmap_syscall __NR_mmap
13 #endif
14
648ff26 @nelhage Start to separate ptrace.c into a library.
authored
15 enum child_state {
16 ptrace_detached = 0,
17 ptrace_at_syscall,
18 ptrace_after_syscall,
19 ptrace_running,
20 ptrace_stopped,
21 ptrace_exited
22 };
23
24 struct ptrace_child {
25 pid_t pid;
26 struct user user;
27 enum child_state state;
28 int status;
29 };
30
35d826e @nelhage Implement memcpy to/from child.
authored
31 typedef unsigned long child_addr_t;
32
648ff26 @nelhage Start to separate ptrace.c into a library.
authored
33 int ptrace_wait(struct ptrace_child *child);
34 int ptrace_attach_child(struct ptrace_child *child, pid_t pid);
35 int ptrace_detach_child(struct ptrace_child *child);
36 int ptrace_wait(struct ptrace_child *child);
37 int ptrace_advance_to_state(struct ptrace_child *child,
38 enum child_state desired);
39 int ptrace_save_regs(struct ptrace_child *child);
40 int ptrace_restore_regs(struct ptrace_child *child);
41 unsigned long ptrace_remote_syscall(struct ptrace_child *child,
42 unsigned long sysno,
43 unsigned long p0, unsigned long p1,
44 unsigned long p2, unsigned long p3,
45 unsigned long p4, unsigned long p5);
35d826e @nelhage Implement memcpy to/from child.
authored
46
fff1db5 @nelhage const fix for memcpy_to_child
authored
47 int ptrace_memcpy_to_child(struct ptrace_child *, child_addr_t, const void*, size_t);
35d826e @nelhage Implement memcpy to/from child.
authored
48 int ptrace_memcpy_from_child(struct ptrace_child *, void*, child_addr_t, size_t);
Something went wrong with that request. Please try again.