• Home
  • Raw
  • Download

Lines Matching refs:pid

39 static void Attach(pid_t pid) {  in Attach()  argument
40 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in Attach()
48 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Attach()
59 ScopedPidReaper(pid_t pid) : pid_(pid) {} in ScopedPidReaper() argument
69 static size_t ProcessVmRead(pid_t pid, uint64_t remote_src, void* dst, size_t len) { in ProcessVmRead() argument
78 ssize_t rc = process_vm_readv(pid, &dst_iov, 1, &src_iov, 1, 0); in ProcessVmRead()
82 static bool PtraceReadLong(pid_t pid, uint64_t addr, long* value) { in PtraceReadLong() argument
86 *value = ptrace(PTRACE_PEEKTEXT, pid, reinterpret_cast<void*>(addr), nullptr); in PtraceReadLong()
93 static size_t PtraceRead(pid_t pid, uint64_t addr, void* dst, size_t bytes) { in PtraceRead() argument
97 if (!PtraceReadLong(pid, addr, &data)) { in PtraceRead()
108 if (!PtraceReadLong(pid, addr, &data)) { in PtraceRead()
117 static void CreateRemoteProcess(size_t size, void** map, pid_t* pid) { in CreateRemoteProcess() argument
125 if ((*pid = fork()) == 0) { in CreateRemoteProcess()
130 if (*pid < 0) { in CreateRemoteProcess()
134 Attach(*pid); in CreateRemoteProcess()
141 pid_t pid; in BM_read_with_ptrace() local
142 CreateRemoteProcess(state.range(0), &map, &pid); in BM_read_with_ptrace()
143 ScopedPidReaper reap(pid); in BM_read_with_ptrace()
148 if (PtraceRead(pid, addr, read_buffer.data(), read_buffer.size()) != read_buffer.size()) { in BM_read_with_ptrace()
153 ptrace(PTRACE_DETACH, pid, 0, 0); in BM_read_with_ptrace()
159 pid_t pid; in BM_read_with_process_vm_read() local
160 CreateRemoteProcess(state.range(0), &map, &pid); in BM_read_with_process_vm_read()
161 ScopedPidReaper reap(pid); in BM_read_with_process_vm_read()
166 if (ProcessVmRead(pid, addr, read_buffer.data(), read_buffer.size()) != read_buffer.size()) { in BM_read_with_process_vm_read()
171 ptrace(PTRACE_DETACH, pid, 0, 0); in BM_read_with_process_vm_read()
177 pid_t pid; in BM_read_with_backtrace_object() local
178 CreateRemoteProcess(state.range(0), &map, &pid); in BM_read_with_backtrace_object()
179 ScopedPidReaper reap(pid); in BM_read_with_backtrace_object()
181 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); in BM_read_with_backtrace_object()
195 ptrace(PTRACE_DETACH, pid, 0, 0); in BM_read_with_backtrace_object()