[Lldb-commits] [lldb] r232158 - Fix SO entry is main executable detection on android
Tamas Berghammer
tberghammer at google.com
Fri Mar 13 04:16:14 PDT 2015
Author: tberghammer
Date: Fri Mar 13 06:16:14 2015
New Revision: 232158
URL: http://llvm.org/viewvc/llvm-project?rev=232158&view=rev
Log:
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
Modified:
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp?rev=232158&r1=232157&r2=232158&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp Fri Mar 13 06:16:14 2015
@@ -120,7 +120,7 @@ DYLDRendezvous::DYLDRendezvous(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(
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;
}
More information about the lldb-commits
mailing list