pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Reduce diff PlatformNetBSD::ResolveExecutable with Linux



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Dec 19 18:45:53 2016 +0100
Changeset:	b8b36b2397d3543c9efeb0774dd4f5c6d0314e87

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp

Log Message:
lldb-netbsd: Reduce diff PlatformNetBSD::ResolveExecutable with Linux

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b8b36b2397d3543c9efeb0774dd4f5c6d0314e87

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |   2 +-
 ...urce_Plugins_Platform_NetBSD_PlatformNetBSD.cpp | 103 +++++++++++++++++++++
 2 files changed, 104 insertions(+), 1 deletion(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 787bf58..49972ab 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -22,7 +22,7 @@ SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4
 SHA1 (patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp) = 8b36c0b8d5c75ce501e4848ca07392a7aab68877
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
 SHA1 (patch-source_Initialization_SystemInitializerCommon.cpp) = b8a2f94eb71dbd265701fdd62e3d36bc0d7081f1
-SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp) = 0445b935f0436088d501d46b2b9bec4c655f0f07
+SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp) = de85a3cc6e100fcfc857d8dd9a8a946a6d9cab86
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c0168f81da56d9896eb414e6b8bb7262de04ac33
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = df17afdf71c29d945c887e318718904793cd48ad
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = f83c6cdb1c66713707e723a342ddfd864048ddba
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp
index 9329607..b5d00fc 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp
@@ -74,3 +74,106 @@ $NetBSD$
  void PlatformNetBSD::Initialize() {
    Platform::Initialize();
  
+@@ -127,20 +156,19 @@ Error PlatformNetBSD::RunShellCommand(co
+ }
+ 
+ Error PlatformNetBSD::ResolveExecutable(
+-    const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp,
++    const ModuleSpec &ms, lldb::ModuleSP &exe_module_sp,
+     const FileSpecList *module_search_paths_ptr) {
+   Error error;
+   // Nothing special to do here, just use the actual file and architecture
+ 
+   char exe_path[PATH_MAX];
+-  ModuleSpec resolved_module_spec(module_spec);
++  ModuleSpec resolved_module_spec(ms);
+ 
+   if (IsHost()) {
+-    // If we have "ls" as the module_spec's file, resolve the executable
+-    // location based on
++    // If we have "ls" as the exe_file, resolve the executable location based on
+     // the current path variables
+     if (!resolved_module_spec.GetFileSpec().Exists()) {
+-      module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
++      resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
+       resolved_module_spec.GetFileSpec().SetFile(exe_path, true);
+     }
+ 
+@@ -163,24 +191,46 @@ Error PlatformNetBSD::ResolveExecutable(
+       // We may connect to a process and use the provided executable (Don't use
+       // local $PATH).
+ 
+-      // Resolve any executable within a bundle on MacOSX
+-      Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
+-
+-      if (resolved_module_spec.GetFileSpec().Exists()) {
++      if (resolved_module_spec.GetFileSpec().Exists())
+         error.Clear();
+-      } else {
+-        error.SetErrorStringWithFormat(
+-            "the platform is not currently connected, and '%s' doesn't exist "
+-            "in the system root.",
+-            resolved_module_spec.GetFileSpec().GetPath().c_str());
+-      }
++      else
++        error.SetErrorStringWithFormat("the platform is not currently "
++                                       "connected, and '%s' doesn't exist in "
++                                       "the system root.",
++                                       exe_path);
+     }
+   }
+ 
+   if (error.Success()) {
+     if (resolved_module_spec.GetArchitecture().IsValid()) {
+       error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
+-                                          module_search_paths_ptr, NULL, NULL);
++                                          NULL, NULL, NULL);
++      if (error.Fail()) {
++        // If we failed, it may be because the vendor and os aren't known. If
++        // that is the
++        // case, try setting them to the host architecture and give it another
++        // try.
++        llvm::Triple &module_triple =
++            resolved_module_spec.GetArchitecture().GetTriple();
++        bool is_vendor_specified =
++            (module_triple.getVendor() != llvm::Triple::UnknownVendor);
++        bool is_os_specified =
++            (module_triple.getOS() != llvm::Triple::UnknownOS);
++        if (!is_vendor_specified || !is_os_specified) {
++          const llvm::Triple &host_triple =
++              HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple();
++
++          if (!is_vendor_specified)
++            module_triple.setVendorName(host_triple.getVendorName());
++          if (!is_os_specified)
++            module_triple.setOSName(host_triple.getOSName());
++
++          error = ModuleList::GetSharedModule(resolved_module_spec,
++                                              exe_module_sp, NULL, NULL, NULL);
++        }
++      }
++
++      // TODO find out why exe_module_sp might be NULL
+ 
+       if (!exe_module_sp || exe_module_sp->GetObjectFile() == NULL) {
+         exe_module_sp.reset();
+@@ -199,7 +249,7 @@ Error PlatformNetBSD::ResolveExecutable(
+            ++idx) {
+         error =
+             ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
+-                                        module_search_paths_ptr, NULL, NULL);
++                                        NULL, NULL, NULL);
+         // Did we find an executable using one of the
+         if (error.Success()) {
+           if (exe_module_sp && exe_module_sp->GetObjectFile())
+@@ -234,8 +284,8 @@ Error PlatformNetBSD::ResolveExecutable(
+ 
+ // From PlatformMacOSX only
+ Error PlatformNetBSD::GetFileWithUUID(const FileSpec &platform_file,
+-                                      const UUID *uuid_ptr,
+-                                      FileSpec &local_file) {
++                                     const UUID *uuid_ptr,
++                                     FileSpec &local_file) {
+   if (IsRemote()) {
+     if (m_remote_platform_sp)
+       return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr,


Home | Main Index | Thread Index | Old Index