diff options
author | Tamas Berghammer <tberghammer@google.com> | 2015-03-13 11:16:14 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2015-03-13 11:16:14 +0000 |
commit | 0deef9c3cbf4101b2a47d8663caf44294e587074 (patch) | |
tree | 9d94af90a72318443ca3fb488eadf4f6f1732c35 | |
parent | a109421936d10840cc24a34dabd0d99c8aadf918 (diff) | |
download | bcm5719-llvm-0deef9c3cbf4101b2a47d8663caf44294e587074.tar.gz bcm5719-llvm-0deef9c3cbf4101b2a47d8663caf44294e587074.zip |
Fix SO entry is main executable detection on android
* On Android (at least on platfrom-21 x86) the dynamic linker reports the
executable with its full path
* Use the platform path of the executable when storing it into the cache
(used to identify the SO entry for the executable) as this is the path
what will be reported by the dynamic linker. If the platform path isn't
set (local debugging) then it falls back to the normal file path.
Differential revision: http://reviews.llvm.org/D8296
llvm-svn: 232158
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index d341d67d448..dc737bdeec3 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -120,7 +120,7 @@ DYLDRendezvous::DYLDRendezvous(Process *process) Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer(); if (exe_mod) { - exe_mod->GetFileSpec().GetPath(m_exe_path, PATH_MAX); + exe_mod->GetPlatformFileSpec().GetPath(m_exe_path, PATH_MAX); if (log) log->Printf ("DYLDRendezvous::%s exe module executable path set: '%s'", __FUNCTION__, m_exe_path); } @@ -281,8 +281,7 @@ bool DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry) { // On Linux the executable is indicated by an empty path in the entry. On - // FreeBSD it is the full path to the executable. On Android, it is the - // basename of the executable. + // FreeBSD and on Android it is the full path to the executable. auto triple = m_process->GetTarget().GetArchitecture().GetTriple(); auto os_type = triple.getOS(); @@ -292,8 +291,12 @@ DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry) case llvm::Triple::FreeBSD: return ::strcmp(entry.path.c_str(), m_exe_path) == 0; case llvm::Triple::Linux: - return entry.path.empty() || (env_type == llvm::Triple::Android && - llvm::sys::path::filename(m_exe_path) == entry.path); + switch (env_type) { + case llvm::Triple::Android: + return ::strcmp(entry.path.c_str(), m_exe_path) == 0; + default: + return entry.path.empty(); + } default: return false; } |