[go: nahoru, domu]

[Android] libheap_profiler/heap_dump: use ptrace instead of SIGSTOP.

This change changes heap_dump to use ptrace rather than SIGSTOP to
freeze the target process. Recent kernels (Android L) forbid to attach
to /proc/PID/mem if the process is not ptrace-d.
This has also two advantageous side effects:
1. PTRACE_ATTACH is independent of the process state (if it was STOPped
   it will stay stopped after the detach).
2. If heap_dump crashes or is killed, the process is automatically
   detached by the kernel (so we can get rid of the SIGPIPE/INT logic).
Furthermore this CL makes the consistency checks optional (adding a -n
switch to disable them).

BUG=382489

Review URL: https://codereview.chromium.org/553403002

Cr-Commit-Position: refs/heads/master@{#294222}
1 file changed