fdtrack: print fdsan owner tag.

Test: logcat -c; fdtrack_test; logcat -d | grep fdtrack
Change-Id: I0a7e342da239a0e7889eb228a3a023268d40b1c5
This commit is contained in:
Josh Gao 2020-01-28 15:13:47 -08:00
parent 50955c461b
commit 6f08866e33

View file

@ -32,6 +32,7 @@
#include <mutex>
#include <vector>
#include <android/fdsan.h>
#include <bionic/fdtrack.h>
#include <android-base/no_destructor.h>
@ -119,7 +120,15 @@ void fdtrack_dump() {
continue;
}
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d:", fd);
uint64_t fdsan_owner = android_fdsan_get_owner_tag(fd);
if (fdsan_owner != 0) {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (owner = %#" PRIx64 ")", fd,
fdsan_owner);
} else {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (unowned)", fd);
}
const size_t frame_skip = 2;
for (size_t i = frame_skip; i < entry->backtrace.size(); ++i) {
auto& frame = entry->backtrace[i];