Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Add systrace output for dlclose/dlsym calls
Browse files Browse the repository at this point in the history
Bug: http://b/27195126
Test: manual: adb shell atrace -t 5 bionic
      and run bionic-unit-tests --gtest_filter=dl*

Change-Id: I9e93a069dd440bb643890d9952913938442ac375
  • Loading branch information
dimitry- committed Mar 21, 2017
1 parent e98d1e6 commit 6705e8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions linker/linker.cpp
Expand Up @@ -1673,6 +1673,8 @@ static void soinfo_unload(soinfo* root) {
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;
Expand Down Expand Up @@ -1999,6 +2001,7 @@ bool do_dlsym(void* handle,
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");
Expand Down Expand Up @@ -2074,6 +2077,7 @@ bool do_dlsym(void* handle,
}

int do_dlclose(void* handle) {
ScopedTrace trace("dlclose");
ProtectedDataGuard guard;
soinfo* si = soinfo_from_handle(handle);
if (si == nullptr) {
Expand Down
3 changes: 2 additions & 1 deletion linker/linker_soinfo.cpp
Expand Up @@ -426,7 +426,8 @@ void soinfo::call_destructors() {
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());
Expand Down

0 comments on commit 6705e8c

Please sign in to comment.