[Lldb-commits] [PATCH] D11465: Fix "process load/unload" on android

Tamas Berghammer via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 27 07:54:09 PDT 2017

tberghammer added a comment.

Hi Nitesh,

The way dlopen, dlclose and dl_phdr_iterate is implemented on android is pretty strange until (and including) SDK 25. The trick is that these functions are implemented inside "/system/bin/linker" with actual function names prefixed with "__dl_". The linker is doing some magic (creating a fake shared library entry at startup) to resolve these symbols when a library is loaded. This magic isn't understand by LLDB so it tries to lookup the symbols in the linker binary itself based on there actual function names. The actual libdl.so file located on the device isn't used for anything (it is there just for some compatibility reasons).

To help me investigate, can you do the followings and attach the output to this thread:

- Run "target modules list" in LLDB
- Run "target modules lookup -n dlopen" in LLDB
- Run "target modules lookup -n __dl_dlopen" in LLDB
- Download "/system/bin/linker" from the device and dump the ".symtab" section of it

Random guesses for what can cause the problem (will be able to more specific based on the above data):

- LLDB fails to detect or load "/system/bin/linker" in the shared library list
- /system/bin/linker doesn't contain a ".symtab" section (e.g. stripped)
- You are using a version of android what have an API 26 /system/bin/linker what had some changes breaking LLDB (Pavel fixed it but the fix only applies for API 26+)



More information about the lldb-commits mailing list