-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Wrapping of Linux' ptrace(2). -- -- An interface for using ptrace to inspect the state of other processes, -- under Linux. @package linux-ptrace @version 0.1.2 module System.Linux.Ptrace.X86_64Regs data X86_64Regs X86_64Regs :: Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> X86_64Regs r15 :: X86_64Regs -> Word64 r14 :: X86_64Regs -> Word64 r13 :: X86_64Regs -> Word64 r12 :: X86_64Regs -> Word64 rbp :: X86_64Regs -> Word64 rbx :: X86_64Regs -> Word64 r11 :: X86_64Regs -> Word64 r10 :: X86_64Regs -> Word64 r9 :: X86_64Regs -> Word64 r8 :: X86_64Regs -> Word64 rax :: X86_64Regs -> Word64 rcx :: X86_64Regs -> Word64 rdx :: X86_64Regs -> Word64 rsi :: X86_64Regs -> Word64 rdi :: X86_64Regs -> Word64 orig_rax :: X86_64Regs -> Word64 rip :: X86_64Regs -> Word64 cs :: X86_64Regs -> Word64 eflags :: X86_64Regs -> Word64 rsp :: X86_64Regs -> Word64 ss :: X86_64Regs -> Word64 fs_base :: X86_64Regs -> Word64 gs_base :: X86_64Regs -> Word64 ds :: X86_64Regs -> Word64 es :: X86_64Regs -> Word64 fs :: X86_64Regs -> Word64 gs :: X86_64Regs -> Word64 instance Show X86_64Regs instance Storable X86_64Regs module System.Linux.Ptrace.X86Regs data X86Regs X86Regs :: Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> X86Regs ebx :: X86Regs -> Word32 ecx :: X86Regs -> Word32 edx :: X86Regs -> Word32 esi :: X86Regs -> Word32 edi :: X86Regs -> Word32 ebp :: X86Regs -> Word32 eax :: X86Regs -> Word32 xds :: X86Regs -> Word32 xes :: X86Regs -> Word32 xfs :: X86Regs -> Word32 xgs :: X86Regs -> Word32 orig_eax :: X86Regs -> Word32 eip :: X86Regs -> Word32 xcs :: X86Regs -> Word32 eflags :: X86Regs -> Word32 esp :: X86Regs -> Word32 xss :: X86Regs -> Word32 instance Show X86Regs instance Storable X86Regs module System.Linux.Ptrace.Types data Regs X86 :: X86Regs -> Regs X86_64 :: X86_64Regs -> Regs data X86Regs data X86_64Regs data Cuser_fpregs_struct data Csiginfo_t instance Storable Csiginfo_t instance Storable Cuser_fpregs_struct instance Show Regs -- | Sadly, only the OS thread which performed the ptrace_attach is allowed -- to mess with the traced process. This means that users of this module -- will need to forkOS or runInBoundThread in order to get reliable -- behaviour. module System.Linux.Ptrace.Syscall data RemotePtr a castRemotePtr :: RemotePtr t -> RemotePtr a -- | Invoke the ptrace system call with various arguments. -- -- Perform one of the PTRACE_PEEK* operations. -- -- Perform one of the PTRACE_POKE* operations. -- -- Perform one of the PTRACE_GET* operations. -- -- Perform one of the PTRACE_SET* operations. -- -- Resume a traced process. -- -- Attach the parent process to this process. ptrace_traceme :: IO () -- | Attach to a process. FIXME: handle EPERM. return IO Bool? ptrace_attach :: CPid -> IO () ptrace_peektext :: CPid -> RemotePtr Word -> IO Word -- | Read a word from the traced process. ptrace_peekdata :: CPid -> RemotePtr Word -> IO Word ptrace_peekuser :: CPid -> RemotePtr Word -> IO Word ptrace_poketext :: CPid -> RemotePtr Word -> Word -> IO () -- | Write a word to the traced process. ptrace_pokedata :: CPid -> RemotePtr Word -> Word -> IO () ptrace_pokeuser :: CPid -> RemotePtr Word -> Word -> IO () ptrace_cont :: CPid -> Maybe Signal -> IO () -- | Continue the traced process, possibly with a signal. ptrace_syscall :: CPid -> Maybe Signal -> IO () ptrace_singlestep :: CPid -> Maybe Signal -> IO () ptrace_detach :: CPid -> Maybe Signal -> IO () -- | Send the traced process a SIGKILL. ptrace_kill :: CPid -> IO () ptrace_getregs :: CPid -> IO Regs ptrace_setregs :: CPid -> Regs -> IO () ptrace_setoptions :: CPid -> [Option] -> IO () ptrace_geteventmsg :: CPid -> IO CULong instance Eq Event instance Show Event instance Eq (RemotePtr a) instance Ord (RemotePtr a) instance Show (RemotePtr a) instance Num (RemotePtr a) instance Bits (RemotePtr a) instance Storable (RemotePtr a) instance Enum (RemotePtr a) instance Real (RemotePtr a) instance Integral (RemotePtr a) module System.Linux.Ptrace data TracedProcess pid :: TracedProcess -> CPid data RemotePtr a castRemotePtr :: RemotePtr t -> RemotePtr a -- | Attach to an existing process traceProcess :: CPid -> IO TracedProcess -- | Attach to a new process traceForkExec :: IO () -> FilePath -> -- [String] -> IO TracedProcess traceForkExec setup file argv = do pid -- - fork (setup > ptrace_traceme >> execvp file argv) -- waitpid pid return $ TracedProcess pid -- -- Continue a process until it hits a signal FIXME: return info about the -- signal continue :: TracedProcess -> IO () detach :: TracedProcess -> IO () peekBytes :: TracedProcess -> RemotePtr a -> Int -> IO ByteString pokeBytes :: TracedProcess -> RemotePtr a -> ByteString -> IO () peek :: Storable a => TracedProcess -> RemotePtr a -> IO a