Add systrace output for dlclose/dlsym calls
Bug: http://b/27195126
Test: manual: adb shell atrace -t 5 bionic
and run bionic-unit-tests --gtest_filter=dl*
Change-Id: I9e93a069dd440bb643890d9952913938442ac375
diff --git a/linker/linker.cpp b/linker/linker.cpp
index a05cd3b..4b00f80 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1673,6 +1673,8 @@
root = root->get_local_group_root();
}
+ ScopedTrace trace((std::string("unload ") + root->get_realpath()).c_str());
+
if (!root->can_unload()) {
TRACE("not unloading \"%s\" - the binary is flagged with NODELETE", root->get_realpath());
return;
@@ -1999,6 +2001,7 @@
const char* sym_ver,
const void* caller_addr,
void** symbol) {
+ ScopedTrace trace("dlsym");
#if !defined(__LP64__)
if (handle == nullptr) {
DL_ERR("dlsym failed: library handle is null");
@@ -2074,6 +2077,7 @@
}
int do_dlclose(void* handle) {
+ ScopedTrace trace("dlclose");
ProtectedDataGuard guard;
soinfo* si = soinfo_from_handle(handle);
if (si == nullptr) {
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index 15f2502..1d59dbb 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -426,7 +426,8 @@
if (!constructors_called) {
return;
}
- TRACE("\"%s\": calling destructors", get_realpath());
+
+ ScopedTrace trace((std::string("calling destructors: ") + get_realpath()).c_str());
// DT_FINI_ARRAY must be parsed in reverse order.
call_array("DT_FINI_ARRAY", fini_array_, fini_array_count_, true, get_realpath());