[Lldb-commits] [PATCH] ComputeSupportExeDirectory for Linux

Chaoren Lin chaorenl at google.com
Tue Mar 24 16:09:56 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8570

Files:
  lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h
  lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
  lldb/trunk/source/Host/android/HostInfoAndroid.cpp
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Host/linux/HostInfoLinux.cpp

Index: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
===================================================================
--- lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
+++ lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
@@ -40,7 +40,7 @@
     static FileSpec GetProgramFileSpec();
 
   protected:
-    static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
+    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
     static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
     static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
     static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
Index: lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h
===================================================================
--- lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h
+++ lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h
@@ -25,7 +25,6 @@
 
   protected:
     static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
-    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
 };
 
 } // end of namespace lldb_private
Index: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
===================================================================
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp
@@ -222,12 +222,14 @@
 }
 
 bool
-HostInfoLinux::ComputeSharedLibraryDirectory(FileSpec &file_spec)
+HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec)
 {
-    if (HostInfoPosix::ComputeSharedLibraryDirectory(file_spec))
+    if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) &&
+            !file_spec.IsRelativeToCurrentWorkingDirectory() &&
+            file_spec.Exists())
         return true;
     file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory();
-    return (bool)file_spec.GetDirectory();
+    return !file_spec.GetDirectory().IsEmpty();
 }
 
 bool
Index: lldb/trunk/source/Host/android/HostInfoAndroid.cpp
===================================================================
--- lldb/trunk/source/Host/android/HostInfoAndroid.cpp
+++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp
@@ -30,13 +30,6 @@
     }
 }
 
-bool
-HostInfoAndroid::ComputeSupportExeDirectory(FileSpec &file_spec)
-{
-    file_spec.GetDirectory() = HostInfoLinux::GetProgramFileSpec().GetDirectory();
-    return (bool)file_spec.GetDirectory();
-}
-
 FileSpec
 HostInfoAndroid::GetDefaultShell()
 {
Index: lldb/trunk/source/Host/common/Host.cpp
===================================================================
--- lldb/trunk/source/Host/common/Host.cpp
+++ lldb/trunk/source/Host/common/Host.cpp
@@ -487,8 +487,6 @@
         if (info.dli_fname)
             module_filespec.SetFile(info.dli_fname, true);
     }
-#else
-    assert(false && "dladdr() not supported on Android");
 #endif
     return module_filespec;
 }

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


More information about the lldb-commits mailing list