reptyr
0.8.0
About: reptyr is a utility for taking an existing running program and attaching it to a new terminal.
![]() ![]() |
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/user.h>
#include <unistd.h>
Go to the source code of this file.
Classes | |
struct | ptrace_child |
struct | syscall_numbers |
Macros | |
#define | PTRACE_SETOPTIONS 0x4200 |
#define | PTRACE_GETEVENTMSG 0x4201 |
#define | PTRACE_GETREGSET 0x4204 |
#define | PTRACE_SETREGSET 0x4205 |
Typedefs | |
typedef unsigned long | child_addr_t |
Enumerations | |
enum | child_state { ptrace_detached = 0, ptrace_at_syscall, ptrace_after_syscall, ptrace_running, ptrace_stopped, ptrace_exited } |
Functions | |
int | ptrace_wait (struct ptrace_child *child) |
int | ptrace_attach_child (struct ptrace_child *child, pid_t pid) |
int | ptrace_finish_attach (struct ptrace_child *child, pid_t pid) |
int | ptrace_detach_child (struct ptrace_child *child) |
int | ptrace_advance_to_state (struct ptrace_child *child, enum child_state desired) |
int | ptrace_save_regs (struct ptrace_child *child) |
int | ptrace_restore_regs (struct ptrace_child *child) |
unsigned long | ptrace_remote_syscall (struct ptrace_child *child, unsigned long sysno, unsigned long p0, unsigned long p1, unsigned long p2, unsigned long p3, unsigned long p4, unsigned long p5) |
int | ptrace_memcpy_to_child (struct ptrace_child *, child_addr_t, const void *, size_t) |
int | ptrace_memcpy_from_child (struct ptrace_child *, void *, child_addr_t, size_t) |
struct syscall_numbers * | ptrace_syscall_numbers (struct ptrace_child *child) |
typedef unsigned long child_addr_t |
enum child_state |
int ptrace_advance_to_state | ( | struct ptrace_child * | child, |
enum child_state | desired | ||
) |
Definition at line 159 of file freebsd_ptrace.c.
References ptrace_child::error, ptrace_child::pid, ptrace_after_syscall, ptrace_at_syscall, ptrace_command, ptrace_running, ptrace_stopped, ptrace_wait(), ptrace_child::state, and ptrace_child::status.
Referenced by grab_pid(), ptrace_remote_syscall(), and ptrace_save_regs().
int ptrace_attach_child | ( | struct ptrace_child * | child, |
pid_t | pid | ||
) |
Definition at line 96 of file freebsd_ptrace.c.
References ptrace_child::pid, ptrace_command, and ptrace_finish_attach().
Referenced by grab_pid(), and preflight_check().
int ptrace_detach_child | ( | struct ptrace_child * | child | ) |
Definition at line 128 of file freebsd_ptrace.c.
References ptrace_command, ptrace_detached, and ptrace_child::state.
Referenced by attach_child(), do_setsid(), grab_pid(), preflight_check(), steal_block_hup(), steal_cleanup_child(), and steal_pty().
int ptrace_finish_attach | ( | struct ptrace_child * | child, |
pid_t | pid | ||
) |
Definition at line 106 of file freebsd_ptrace.c.
References arch_get_personality(), ptrace_child::pid, ptrace_command, and ptrace_wait().
Referenced by do_setsid(), and ptrace_attach_child().
int ptrace_memcpy_from_child | ( | struct ptrace_child * | child, |
void * | dst, | ||
child_addr_t | src, | ||
size_t | n | ||
) |
Definition at line 299 of file freebsd_ptrace.c.
References ptrace_child::error, min, and ptrace_command.
int ptrace_memcpy_to_child | ( | struct ptrace_child * | child, |
child_addr_t | dst, | ||
const void * | src, | ||
size_t | n | ||
) |
Definition at line 276 of file freebsd_ptrace.c.
References ptrace_child::error, and ptrace_command.
Referenced by attach_child(), ignore_hup(), setup_steal_socket_child(), steal_child_pty(), and steal_cleanup_child().
unsigned long ptrace_remote_syscall | ( | struct ptrace_child * | child, |
unsigned long | sysno, | ||
unsigned long | p0, | ||
unsigned long | p1, | ||
unsigned long | p2, | ||
unsigned long | p3, | ||
unsigned long | p4, | ||
unsigned long | p5 | ||
) |
Definition at line 218 of file freebsd_ptrace.c.
References arch_get_register(), ptrace_child::error, personality(), ptrace_advance_to_state(), ptrace_after_syscall, ptrace_at_syscall, ptrace_command, and setreg.
Referenced by mmap_scratch().
int ptrace_restore_regs | ( | struct ptrace_child * | child | ) |
Definition at line 210 of file freebsd_ptrace.c.
References arch_restore_syscall(), and ptrace_command.
Referenced by attach_child(), do_setsid(), grab_pid(), steal_block_hup(), steal_cleanup_child(), and steal_pty().
int ptrace_save_regs | ( | struct ptrace_child * | child | ) |
Definition at line 198 of file freebsd_ptrace.c.
References arch_fixup_regs(), arch_save_syscall(), ptrace_advance_to_state(), ptrace_at_syscall, and ptrace_command.
Referenced by grab_pid().
struct syscall_numbers* ptrace_syscall_numbers | ( | struct ptrace_child * | child | ) |
Definition at line 92 of file freebsd_ptrace.c.
References arch_syscall_numbers, and ptrace_child::personality.
Referenced by do_dup2(), do_fork(), and mmap_scratch().
int ptrace_wait | ( | struct ptrace_child * | child | ) |
Definition at line 135 of file freebsd_ptrace.c.
References ptrace_child::error, ptrace_child::forked_pid, ptrace_child::pid, ptrace_after_syscall, ptrace_at_syscall, ptrace_command, ptrace_exited, ptrace_stopped, ptrace_child::state, and ptrace_child::status.
Referenced by do_setsid(), ptrace_advance_to_state(), ptrace_finish_attach(), and steal_cleanup_child().