[Lldb-commits] [PATCH] Fix SO entry is main executable detection on android

Tamas Berghammer tberghammer at google.com
Fri Mar 13 04:18:54 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8296

Files:
  lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp

Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
===================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -120,7 +120,7 @@
         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 @@
 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 @@
         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;
     }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8296.21918.patch
Type: text/x-patch
Size: 1784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150313/2fe75163/attachment.bin>


More information about the lldb-commits mailing list