Lines Matching full:child
13 * Child subroutine that performs a load on the address, then traps
24 * Child subroutine that performs a load on the first address, then a load on
173 * Checks if we can place at least 2 watchpoints on the child process
186 * Wrapper around a plain fork() call that sets up the child for
187 * ptrace-ing. Both the parent and child return from this, though
188 * the child is stopped until ptrace_cont(pid) is run by the parent.
197 FAIL_IF_MSG(1, "Failed to fork child"); in ptrace_fork_child()
201 FAIL_IF_EXIT_MSG(raise(SIGSTOP), "Child failed to raise SIGSTOP"); in ptrace_fork_child()
203 /* Synchronise on child SIGSTOP */ in ptrace_fork_child()
204 FAIL_IF_MSG(waitpid(*pid, &status, 0) == -1, "Failed to wait for child"); in ptrace_fork_child()
205 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in ptrace_fork_child()
218 * semantics. E.g., if ptrace changes the child PC, we don't even execute the
221 * When the child is stopped for ptrace, we test both continue and single step.
231 pid_t pid; /* PID of child process */ in same_watch_addr_test()
232 void *pc; /* Most recently fetched child PC value */ in same_watch_addr_test()
233 int status; /* Stop status of child after waitpid */ in same_watch_addr_test()
234 unsigned long value; /* Dummy value to be read/written to by child */ in same_watch_addr_test()
259 /* Let the child run. It should stop on the ptrace watchpoint */ in same_watch_addr_test()
260 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
262 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
263 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
264 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
265 FAIL_IF_MSG(pc != same_watch_addr_load, "Child did not stop on load instruction"); in same_watch_addr_test()
275 FAIL_IF_MSG(ptrace_singlestep(pid, 0), "Failed to single step child"); in same_watch_addr_test()
277 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
278 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
279 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
292 FAIL_IF_MSG(ptrace_setreg_pc(pid, same_watch_addr_load), "Failed to set child PC"); in same_watch_addr_test()
293 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
295 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
296 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
297 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
298 FAIL_IF_MSG(pc != same_watch_addr_load, "Child did not stop on load trap"); in same_watch_addr_test()
303 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
305 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
306 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
307 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
308 FAIL_IF_MSG(pc != same_watch_addr_trap, "Child did not stop on end trap"); in same_watch_addr_test()
313 * If we set the child PC back to the load instruction, then continue, in same_watch_addr_test()
317 FAIL_IF_MSG(ptrace_setreg_pc(pid, same_watch_addr_load), "Failed to set child PC"); in same_watch_addr_test()
318 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
320 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
321 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
322 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
323 FAIL_IF_MSG(pc != same_watch_addr_trap, "Child did not stop on end trap"); in same_watch_addr_test()
328 * If we set the child PC back to the load instruction, set a ptrace in same_watch_addr_test()
335 FAIL_IF_MSG(ptrace_setreg_pc(pid, same_watch_addr_load), "Failed to set child PC"); in same_watch_addr_test()
336 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
338 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
339 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
340 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
341 FAIL_IF_MSG(pc != same_watch_addr_load, "Child did not stop on load instruction"); in same_watch_addr_test()
350 FAIL_IF_MSG(ptrace_setreg_pc(pid, same_watch_addr_load + 4), "Failed to set child PC"); in same_watch_addr_test()
351 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in same_watch_addr_test()
353 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in same_watch_addr_test()
354 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in same_watch_addr_test()
355 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in same_watch_addr_test()
356 FAIL_IF_MSG(pc != same_watch_addr_trap, "Child did not stop on end trap"); in same_watch_addr_test()
360 /* Clean up child */ in same_watch_addr_test()
361 FAIL_IF_MSG(kill(pid, SIGKILL) != 0, "Failed to kill child"); in same_watch_addr_test()
385 pid_t pid; /* PID of child process */ in perf_then_ptrace_test()
386 void *pc; /* Most recently fetched child PC value */ in perf_then_ptrace_test()
387 int status; /* Stop status of child after waitpid */ in perf_then_ptrace_test()
397 * If we are the child, run a subroutine that reads the perf value, in perf_then_ptrace_test()
419 /* Let the child run. It should stop on the ptrace watchpoint */ in perf_then_ptrace_test()
420 FAIL_IF_MSG(ptrace_cont(pid, 0), "Failed to continue child"); in perf_then_ptrace_test()
422 FAIL_IF_MSG(waitpid(pid, &status, 0) == -1, "Failed to wait for child"); in perf_then_ptrace_test()
423 FAIL_IF_MSG(!WIFSTOPPED(status), "Child is not stopped"); in perf_then_ptrace_test()
424 FAIL_IF_MSG(ptrace_getreg_pc(pid, &pc), "Failed to get child PC"); in perf_then_ptrace_test()
425 FAIL_IF_MSG(pc != perf_then_ptrace_load2, "Child did not stop on ptrace load"); in perf_then_ptrace_test()
431 /* Clean up child */ in perf_then_ptrace_test()
432 FAIL_IF_MSG(kill(pid, SIGKILL) != 0, "Failed to kill child"); in perf_then_ptrace_test()