summaryrefslogtreecommitdiffstats
path: root/debuggerd/backtrace.cpp
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@cyngn.com>2016-09-07 13:30:24 -0700
committerJessica Wagantall <jwagantall@cyngn.com>2016-09-07 13:30:24 -0700
commitb58cc75fe8243ca0319d6d6db27a750579e01433 (patch)
tree80b7b6cac8fee1c2cf54316b8912caf29d5de6d0 /debuggerd/backtrace.cpp
parentc00328f99aad5f1e8e879557f142981f08146fe3 (diff)
parent4cc6d3d4057ef566a87a2e1db2c4c152b52e0765 (diff)
downloadsystem_core-b58cc75fe8243ca0319d6d6db27a750579e01433.tar.gz
system_core-b58cc75fe8243ca0319d6d6db27a750579e01433.tar.bz2
system_core-b58cc75fe8243ca0319d6d6db27a750579e01433.zip
Merge tag 'android-6.0.1_r66' into HEAD
Android 6.0.1 release 66 Change-Id: I5ccc6e68283e30b8d0419eb7512c7183e58ec5ed
Diffstat (limited to 'debuggerd/backtrace.cpp')
-rw-r--r--debuggerd/backtrace.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/debuggerd/backtrace.cpp b/debuggerd/backtrace.cpp
index b8084c517..ad6a6ee61 100644
--- a/debuggerd/backtrace.cpp
+++ b/debuggerd/backtrace.cpp
@@ -67,8 +67,8 @@ static void dump_process_footer(log_t* log, pid_t pid) {
_LOG(log, logtype::BACKTRACE, "\n----- end %d -----\n", pid);
}
-static void dump_thread(
- log_t* log, pid_t tid, bool attached, bool* detach_failed, int* total_sleep_time_usec) {
+static void dump_thread(log_t* log, pid_t pid, pid_t tid, bool attached,
+ bool* detach_failed, int* total_sleep_time_usec) {
char path[PATH_MAX];
char threadnamebuf[1024];
char* threadname = NULL;
@@ -88,7 +88,7 @@ static void dump_thread(
_LOG(log, logtype::BACKTRACE, "\n\"%s\" sysTid=%d\n", threadname ? threadname : "<unknown>", tid);
- if (!attached && ptrace(PTRACE_ATTACH, tid, 0, 0) < 0) {
+ if (!attached && !ptrace_attach_thread(pid, tid)) {
_LOG(log, logtype::BACKTRACE, "Could not attach to thread: %s\n", strerror(errno));
return;
}
@@ -117,7 +117,7 @@ void dump_backtrace(int fd, int amfd, pid_t pid, pid_t tid, bool* detach_failed,
log.amfd = amfd;
dump_process_header(&log, pid);
- dump_thread(&log, tid, true, detach_failed, total_sleep_time_usec);
+ dump_thread(&log, pid, tid, true, detach_failed, total_sleep_time_usec);
char task_path[64];
snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid);
@@ -135,7 +135,7 @@ void dump_backtrace(int fd, int amfd, pid_t pid, pid_t tid, bool* detach_failed,
continue;
}
- dump_thread(&log, new_tid, false, detach_failed, total_sleep_time_usec);
+ dump_thread(&log, pid, new_tid, false, detach_failed, total_sleep_time_usec);
}
closedir(d);
}